Skip to content

AI keeps placing hotels on fully developed lands #46

@Seniru

Description

@Seniru

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions