Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI keeps placing hotels on fully developed lands #46

Open
Seniru opened this issue Jul 14, 2024 · 0 comments
Open

AI keeps placing hotels on fully developed lands #46

Seniru opened this issue Jul 14, 2024 · 0 comments

Comments

@Seniru
Copy link

Seniru commented Jul 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant