Giter VIP home page Giter VIP logo

monopoly's Introduction

monopoly

A JavaScript/HTML/CSS Monopoly implementation with full game play. Supports two-eight players.

Play online at http://www.intrepidcoder.com/projects/monopoly/.

Includes an experimental capability to play against an AI. A test AI for demonstration purposes is included.

monopoly's People

Contributors

intrepidcoder avatar lincerely avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monopoly's Issues

have a question

i was trying to make another version from this code where the player will be asked question if he answered it correct he will be eligible to buy the town otherwise he won not be eligible after i did the code all the way i have face problem that the user when he asked the question first time and answered it wrong the buy order is sent iam not sure how i have tracked the code many time and nothing show there a calculator for that numbers of pressed in buy i know you build this game to not need to press buy order in same town more than once but i would like to ask you if you have any idea what would reason that ? like if there a function or something that get every press on buy button and thank you in advance

Go to jail

The go to jail square doesn't actually send you to jail

Broken trading

There is no way to select different user than the first one while trading.

How to reproduce?

  1. Start a game with at least three players.
  2. Buy a property.
  3. Start trading.
  4. Try to change player.

Select appears to be broken.

Mortgage interest should be 10% of the mortgage value

document.getElementById("mortgagebutton").value = "Unmortgage ($" + Math.round(sq.price * 0.6) + ")";

The official rules state that "in order to lift the mortgage, the owner must pay the Bank the
amount of the mortgage plus 10% interest." The loan amount is the mortgage value, so it seems reasonable to interpret this as 10% of half the price, or %55 of the list price in total to unmortgage.

Right now it is implemented at 10% of the list price or %60 in total.

Idea

Do you have plans to add an online server where you can play with friends?

AI keeps placing hotels on fully developed lands

Hello!

After AI has fully developed a set (that is placing hotels on all lands in a particular color), it keeps on adding more hotels to the land. This doesn't change the rent or anything, however, it just drains money from AI pretty much every round (also spams the log with false notifications).

Here are some of the game logs

...
AI Test 1 landed on Baltic Avenue.
AI Test 1 bought Baltic Avenue for $60.
...
seniru landed on Mediterranean Avenue.
seniru bought Mediterranean Avenue for $60.
AI Test 1 received Mediterranean Avenue from seniru.
...
AI Test 1 placed a house on Baltic Avenue.
AI Test 1 placed a house on Mediterranean Avenue.
...
AI Test 1 placed a house on Baltic Avenue.
AI Test 1 placed a house on Mediterranean Avenue.
...
AI Test 1 placed a house on Baltic Avenue.
AI Test 1 placed a house on Mediterranean Avenue.
...
AI Test 1 placed a house on Baltic Avenue.
AI Test 1 placed a house on Mediterranean Avenue.
...
AI Test 1 placed a hotel on Baltic Avenue.
AI Test 1 placed a hotel on Mediterranean Avenue.
...
AI Test 1 placed a hotel on Baltic Avenue.
AI Test 1 placed a hotel on Baltic Avenue.
...
AI Test 1 placed a hotel on Baltic Avenue.
AI Test 1 placed a hotel on Baltic Avenue.
...
AI Test 1 placed a hotel on Baltic Avenue.
AI Test 1 placed a hotel on Baltic Avenue.
...
AI Test 1 placed a hotel on Baltic Avenue.
...

I've checked the code, think this check should be updated to fix this bug (https://github.com/intrepidcoder/monopoly/blob/master/ai.js#L98-100)
To something like this

// ..
				if (p.money > leastHouseProperty.houseprice + 100 &&  leastHouseNumber < 5) {
// ..

Additionally, adding some checks to these lines before letting a player/AI to buy a hotel also sounds like a good idea?
Original code:
https://github.com/intrepidcoder/monopoly/blob/master/monopoly.js#L2051-L2058

Updated conditional:

// ...
			if (hotelSum >= 12 || sq.hotel == 1) {
				return;

			} else {
// ...

I'd love to send a pull request with the necessary changes if you want to. Thanks!

PS: I've enjoyed your game a lot! This is a good game to play idle because of the AI feature.

AI cannot unmortgage inherited properties

When an AI player that has mortgaged properties loses to another AI player, the option to unmortgage is controlled by the human player (even when it’s not the human player’s turn) and not the AI who won them.

No visible indication of a color property

By looking at the board game there is no way to know which properties have which colors.

Let's take "Oriental Avenue", in order to know the color of it (light blue), one needs to hover over mouse on it in order to see it.

Add some AIs

I updated the user interface to support AIs. Now I just need to write one. Several different difficulties would be nice. In any one cares to implement one, send me a pull request. I wrote a reference AI, look at the AITest object in the Monopoly.js file.

Chance: Advance to nearest railroad and pay double

Hello - The Chance card Advance token to nearest railroad. Pay owner twice the rental to which he/she is entitled is not making the player pay twice the amount. The player still pays the regular amount.

Don't Have to Leave Jail or Pay $50

I can stay in jail for longer than 3 turns and I don't have to pay the $50 dollar fine. Make it so that on the third turn if a player rolls and doesn't get doubles, the player is moved to the Just Visiting square and loses $50.

interested in this work

I would like to publish a boardgame similar to monopoly, and I find this work is amazing. Would like to know if youre interested in joining our project😏

Trade Bug?

The AI players seem to keep giving me Utilities for free - not that I'm complaining, but should that be happening?

Game will not start with 8 players

The game starts as normal with 2-7 players but selecting 8 players will make everything load but the game does not start. This occurs regardless of the number of human/AI players involved.

Anti-monopolist ruleset

I got an email from Tom Fotheringham and he requested I add an issue here to bring it to your attention. I did mention 99% of the credit goes to you @intrepidcoder. It's an interesting concept and the guy is pretty cool.

Hello,

I just discovered the Monipoly game which you and Daniel Moyer wrote.  I have some ideas on how this could be made into a significant contribution to the field of political economics, specifically to the ideas of Henry George.  As you probably know Monopoly is based on the Landlord's Game patented in 1904 by Elizabeth Magie to educate users about Georgism.  There were two sets of rules, one monopolist which results in only one winner, the other anti- monopolist which results in all players winning (not losing).

With slight changes to the game you have written I believe you could achieve Magie's goal by allowing users to adjust the rules and have it played by all AI players letting the game run automatically for thousands of moves in seconds. The object would be to find the smallest changes to the standard rules that would result in the highest number of iterations without anyone losing.
The point of this would be to illustrate how our economic system could be adjusted to basically eliminate poverty.
If you're interested I'd love to share more.
I'm a retired programmer 75 years old. I could maybe do it myself but I'd rather share the project with others.
Let me know if you or anyone you know might be interested.

Tom Fotheringham
Ottawa, Canada

Add Networking

Adding networking to this game would be amazing! I am not sure if it is entirely possible without having to rewrite the entire game, but a possible suggestion would be to use socket.io. Is this possible? I would love to help, but I am fairly new to javascript.

AI cannot fully process trades

AI-to-AI trading needs some extra polish. Regular trading seems to be okay but any counteroffers fall into the control of the human player(s), even if it isn’t their turn.

AI declares false bankruptcy when left with lands with houses/hotels

AI is unable to sell houses/hotels on lands and as a result it declares in bankruptcy (while having more property to sell/mortgage)

https://github.com/intrepidcoder/monopoly/blob/master/ai.js#L177-192

I've had a quick look at the code, think this needs to be changed.

if (s.owner === p.index && !s.mortgage) {
        if (s.house === 0) {
	        mortgage(i);
	        console.log(s.name);
        } else {
                // logic to sell houses/hotels in each land consecutively as needed
        }
}

I'd love to open a PR with necessary changes if you want me to. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.