Skip to main content
GameDev.net gamedev.net
🔒 Locked

An expert system for monopoly

Started by acer3 Mar 10, 2011 at 5:55 PM 20 replies 10.5k views
Original Post
acer3
acer3
Our thesis requires us to create an expert system that would substitute missing players in monopoly.
The AI should be able to base its actions on the probabilities and apply strategies for the game.

What algorithm should we use?
Is the minimax algorithm applicable for monopoly?
Storyyeller
Storyyeller
I've never done anything like it before, but here's what I'd try

First precalculate the long term probabilities of landing on each square, which can be calculated exactly using some linear algebra.
You'll need to precalculate at least two sets of this data: one for when people try to leave jail (early game) and one for when people stay in jail as long as possible (late game).
Remember to factor in chance cards to these probabilities.

Now these long term probabilities can be used to estimate a value for each property, to be used when deciding what to buy and where to build houses.


Finally, you'll probably want to do adjustments based on players positions on the board and how close they are to bankruptcy. Perhaps you could project a turn or two into the future, minmax style.


Other than that, there's not much to the game. It's mostly luck based.
I trust exceptions about as far as I can throw them.
IADaveMark
IADaveMark
Maximization of expected utility.

Pre-calc strengths of various spaces. Assign cost/benefit ratios for each purchase. Add in the values of near-term potential gains (e.g. having 2 of one area is better than having 1 each of 2 areas). In trades, consider the other person's gain/loss compared to their overall position as well as doing the same for your own. That is, you don't want to do something that is moderately good for you if it is REALLY good for them. Likewise, you can be harsh with someone who is in dire straits. Remember to include marginal utility (both increasing and decreasing) as well as straight-up value.

Other than that, I would leave out any die-roll prediction stuff. It is too transient.

This can all be boiled down to a single score for purchasing one property, building on a property, trading for properties, etc. These scores can be compared against other options to select the best option at any one time.

Oh... to answer one of your questions: minmax would fall flat almost immediately because the branching factor is not only huge, it is stochastic based on die rolls. Add in that the person may elect to do the action or not, and you have a big unknown for each ply. That is, while players take turns, it isn't a deterministic change from state to state.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
Storyyeller
Storyyeller

Maximization of expected utility.

Pre-calc strengths of various spaces. Assign cost/benefit ratios for each purchase. Add in the values of near-term potential gains (e.g. having 2 of one area is better than having 1 each of 2 areas). In trades, consider the other person's gain/loss compared to their overall position as well as doing the same for your own. That is, you don't want to do something that is moderately good for you if it is REALLY good for them. Likewise, you can be harsh with someone who is in dire straits. Remember to include marginal utility (both increasing and decreasing) as well as straight-up value.

Other than that, I would leave out any die-roll prediction stuff. It is too transient.

This can all be boiled down to a single score for purchasing one property, building on a property, trading for properties, etc. These scores can be compared against other options to select the best option at any one time.

Oh... to answer one of your questions: minmax would fall flat almost immediately because the branching factor is not only huge, it is stochastic based on die rolls. Add in that the person may elect to do the action or not, and you have a big unknown for each ply. That is, while players take turns, it isn't a deterministic change from state to state.


I think dice roll predicition could be useful once all the properties have been bought, because at that point it's just a matter of estimating who is likeliest to encounter gambler's ruin first.
I trust exceptions about as far as I can throw them.
IADaveMark
IADaveMark

I think dice roll predicition could be useful once all the properties have been bought, because at that point it's just a matter of estimating who is likeliest to encounter gambler's ruin first.

But what do you gain by this? Unless you are using it to decide which properties to put that extra house on, it's irrelevant. Also, the spread on 2d6 is subtle enough that moving +/- one result isn't that big of a change. i.e. there isn't that significant of a % difference from 7 to 8 that it is really a deciding factor.

Incidentally, I did a mathematical analysis of the board, and the cost-benefit rates about 15 years ago. The 2nd grouping, (Ontario, Ventor, etc.) is the best grouping to buy by a slim margin.


Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
alvaro
alvaro
I haven't played Monopoly in many years, and I was never a big fan. My recollection is that you should basically always buy the properties you can and always build up whatever you can. Perhaps this is too simplistic, but I am sure you can come up with a rule-based system that would play roughly correctly using very little time to make decisions. Then you can throw Monte Carlo sampling at the problem, using that policy to simulate future results. I imagine this would result in a strong program, and you don't even need to write an evaluation function.

If you manage to write a good evaluation function (a prediction of the probability that you will win from a given position), you can stop the Monte Carlo simulations after only a few moves and use your evaluation function as the result.
IADaveMark
IADaveMark

I haven't played Monopoly in many years, and I was never a big fan. My recollection is that you should basically always buy the properties you can and always build up whatever you can. Perhaps this is too simplistic, but I am sure you can come up with a rule-based system that would play roughly correctly using very little time to make decisions. Then you can throw Monte Carlo sampling at the problem, using that policy to simulate future results. I imagine this would result in a strong program, and you don't even need to write an evaluation function.

If you manage to write a good evaluation function (a prediction of the probability that you will win from a given position), you can stop the Monte Carlo simulations after only a few moves and use your evaluation function as the result.


Nah... you have to do evaluations because the entire midgame is based on "should I build? If so, on which of my properties? How much do I need to keep on-hand for emergencies (landing on stuff)?" All comparisons and evaluations.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
Storyyeller
Storyyeller

But what do you gain by this? Unless you are using it to decide which properties to put that extra house on, it's irrelevant. Also, the spread on 2d6 is subtle enough that moving +/- one result isn't that big of a change. i.e. there isn't that significant of a % difference from 7 to 8 that it is really a deciding factor.

Incidentally, I did a mathematical analysis of the board, and the cost-benefit rates about 15 years ago. The 2nd grouping, (Ontario, Ventor, etc.) is the best grouping to buy by a slim margin.


But the extra information is still better than nothing, though it will only have a significant effect if someone is already very close to losing.

Also, IIRC the reds and oranges are the best properties to have. Purples are the worst by a huge margin.
I trust exceptions about as far as I can throw them.
owl
owl

Also, IIRC the reds and oranges are the best properties to have. Purples are the worst by a huge margin.


I do not agree. If you get to have hotels in BOARDWALK AND PARK PLACE you can ruin almost everyone. BALTIC AV. and MEDITERRANEAN are also a must-have because they are cheap to build in and are right after GO, falling in them after collecting GO can easily mine people's moral (along with some strategic mocking lol).
[size="2"]I like the Walrus best.
Storyyeller
Storyyeller
But the red properties are the most frequently landed on.

If you rank every property by (probability of landing on)/ (cost), Mediterranean avenue is in last place by nearly an order of magnitude.

Also, another interesting tip is that the third house is the most cost effective improvement.
I trust exceptions about as far as I can throw them.
owl
owl

But the red properties are the most frequently landed on.

If you rank every property by (probability of landing on)/ (cost), Mediterranean avenue is in last place by nearly an order of magnitude.

Also, another interesting tip is that the third house is the most cost effective improvement.


Again, if you own boardwalk/parkplace (and very likely you'll have something else) you can afford to pay any other rent. The more players you play against, the more chances you'll kick their asses.
[size="2"]I like the Walrus best.
IADaveMark
IADaveMark

[quote name='Storyyeller' timestamp='1299906195' post='4784688']
Also, IIRC the reds and oranges are the best properties to have. Purples are the worst by a huge margin.


I do not agree. If you get to have hotels in BOARDWALK AND PARK PLACE you can ruin almost everyone. BALTIC AV. and MEDITERRANEAN are also a must-have because they are cheap to build in and are right after GO, falling in them after collecting GO can easily mine people's moral (along with some strategic mocking lol).
[/quote]
You are wrong on so many levels here.

First, BW and PP have high payouts when they are developed, however the cost of developing them to that level is significant. Therefore, it takes a long time to get to that point. Keep in mind that all property sets have an almost proportional cost/benefit for buying and developing. The difference is that each 2nd group on each side is slightly better than the first group. It's just the way the math works. Also, because BW and PP are only 2 spaces instead of 3, the odds of someone landing on them in a given circuit are much less than a 3-spot monopoly. Considering that you only need to land on 1 of the n spaces to get the payout, the 3-space ones have a 50% increased likelyhood over the 2-space ones.

Baltic and Med are actually pretty tame for some of the reasons mentioned above. 2 spaces only, they are the 1st set on a street rather than 2nd (so the payout to development ratio is smaller). Also, there are opportunities where people are instructed via cards to "proceed to go". That reduces the likelyhood that B and Med are landed on because of the probability curve of the dice.

This is also a reason that the light blues (Conn., Vmt., Oriental) have a slight advantage. They are square in the middle of the probability curve when starting at GO. The only other grouping with a similar advantage are the oranges when departing from jail. Additionally, they are less expensive to build up. This is a significant advantage early in the game where you can build them up long before you could even buy some of the more expensive properties. Also, early in the game, the payouts on those properties will have a marked effect on people as a whole because there is likely less money "in the game" as a whole.


Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
IADaveMark
IADaveMark

Again, if you own boardwalk/parkplace (and very likely you'll have something else) you can afford to pay any other rent. The more players you play against, the more chances you'll kick their asses.

You are failing to do the math here. The formula for calculating the payout needs to be:

ExpectedReturn = ReturnPerLand * LandingPct

The % chance for landing on BW or PP is 2/40 or 5% (not counting any biases for things like Go).

If you take the same amount of money that you spend on BW/PP and spread it across 3 groupings of 3, for example, you have spent the same money but now have a 9/40 landing %... or 22.5%. That means it is over 4 times more likely to hit one of those 9 properties than it is to hit either BW or PP. If the payoff for any of those groupings is even only 25% of the payoff for BW/PP, you come out the same. The big difference is that you may be waiting for a long time for someone to hit your BW/PP combo whereas on any given circuit, someone is going to likely hit at least one... likely more... of your 9 properties. As you add more players, you are getting almost a constant income (and constantly draining them) rather that hoping for the one big payoff... that may never come.


Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
owl
owl
Again, you'll probably have other properties besides BW/PP. You are putting it like "hey if I own the entire board and you only have those two the odds are against you". That's lame.
You are not taking into account "the odds" of going bankrupt if landing there. And that if you own them you don't have to worry about not landing in them later in the game (and losing almost definitely)


It's not just the odds of landing on a property what counts. It's also how much you make from it and how bad you hurt your opponents by owning it.
[size="2"]I like the Walrus best.
IADaveMark
IADaveMark

It's not just the odds of landing on a property what counts. It's also how much you make from it and how bad you hurt your opponents by owning it.

And you're forgetting to include the cost of development. You get more from BW/PP, but it takes more to buy it.
You're also assuming infinite cash to spend rather than figuring bang for buck.

For example, it costs $750 to purchase just the properties of BW/PP. For that amount of money, I can purchase all of the light blues and the purples. (side 1, group 2, and side 2, group 1, respectively) I now have 6 spaces of 2 monopolies for the same amount of money of the 1 mono with 2 spaces. That's where the percentage chance of cashing in comes in. The players in the game are 3x as likely to hit my 6 spaces as they are your 2.

Of course, there is the the rent to consider. The average starting rent for BW/PP is 42.5, whereas the average starting rent for the properties listed above is 8.6. Add in the 3x likelyhood of collecting and you get 3 * 8.6 = 26.

The ROI for those two types of purchases is:

26/$750 = 3.4% ROI per opponent, per circuit
42/$750 = 5.6% ROI per opponent, per circuit

Now... while this seems that BW/PP has the advantage (42:26), you have to consider your ability to purchase those properties. Money is, of course, finite.

While this doesn't seem to be an issue with just the properties alone, it is the improvements of the properties that begins to nudge up against the money limits.

To fully develop those 6 properties (hotel on each), costs (3*5*$50) + (3*5*$100) = $2250 for a total cost of ownership of $3000
To fully develop BW/PP (hotel on each) (2*5*$200) = $2000 for a TCO of $2750

Again, those are comperable.

The fully upgraded rents are:
6 props = $683 / ea
BW/PP = $1750 / ea

The new ROIs are
6 props = 683 / 3000 = 22.8% per opp, per circuit
...but this needs to be multiplied by 3 because of the 3x likelihood of hit. Therefore 68.4%


BW/PP = $1750 / 2750 = 63.6% per opp, per circuit

So, the 6 properties mentioned, fully developed, outpace BW/PP despite costing the same to purchase and the same to upgrade fully.

The significant difference in the approaches is how often you will get paid. As I mentioned before the 6-property strategy will likely provide a stream of income over time -- especially with more than one opponent. Even with one opponent, it is likely that he will hit at least one of your properties on any given circuit. In fact, it is somewhat likely that he will hit 2 of them. However, not only is it far less likely that someone will hit your precious BW/PP on any given circuit, but the odds are incredibly slim that they will hit both (have to land on PP and then roll a 2 to hit BW... a < 3% chance). That said, even multiple players can quite easily make circuits without ever hitting BW/PP! It doesn't matter how much you can charge if they never land on your stuff. We're starting to talk lottery here.

In fact, a lottery is a good example of how we, as humans, value money. Consider these choices.

100% chance of getting $100
50% chance of getting $200
25% chance of getting $400
10% chance of getting $1000
1% chance of getting $10,000

Mathematically, those are all the same. However, most people will choose from the first 3. They would rather have money in their pocket than nothing at all.

Things even get more significant as we push the values higher.


100% chance of getting $1000
50% chance of getting $2000
25% chance of getting $4000
10% chance of getting $10,000
1% chance of getting $100,000

Given those values, people are even MORE likely to select the $1000 or $2000. The more zeros you add, the more people are likely to take the money and run. The reason for this is diminishing marginal utility. Once we get to the point of having "enough", we are less interested in the extra value... especially if it means losing everything entirely (by not winning).

The similar effect in the case of Monopoly is betting so much on the slim odds that people will land on your BW/PP combo rather than the guaranteed income of 6 mid-valued properties (that cost the same in total). Chances are, you won't last long enough to collect.

To the OP, I hope this gives you an idea of how a Monopoly bot can be programmed using nothing but maximization of expected utility.

cool.gif
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
owl
owl
I agree that if you own 6 properties you have more chances of getting visited than if you own 2.
If anything, owning two complete colors with 3 properties each is at least twice as difficult as owning 1 color with two properties (considering trade between infinite players randomly).
[size="2"]I like the Walrus best.
acer3
acer3
thank you guys for responding. this would help us a lot with our game. smile.gif
Storyyeller
Storyyeller
The problem with the analysis above is that you are forgetting to factor in the different probabilities of landing on different squares. In particular, red and orange spaces are heavily favored once you factor in the odds of going to jail. This has the effect of making blue and purples comparatively even worse.
I trust exceptions about as far as I can throw them.
IADaveMark
IADaveMark

The problem with the analysis above is that you are forgetting to factor in the different probabilities of landing on different squares. In particular, red and orange spaces are heavily favored once you factor in the odds of going to jail. This has the effect of making blue and purples comparatively even worse.

I had included that in one of my original posts. However, I had forgotten about the "jail" and "advance to St. Charles" issues which do tend to bias the red/orange. Still, the "proceed to GO" gives a bump to the light blues. The absolute most infrequent squares are Med/Baltic.

Still, these are very small biases to the overall concept of the odds of landing on a group of 3 than a group of 2. Or... in the case of my example, landing on one of 6 properties rather than 2.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
Storyyeller
Storyyeller
I guess you could call it Utility Maximization or something.
I trust exceptions about as far as I can throw them.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.