Monopoly Follow Up

When I posted initially about making Monopoly in Excel I mentioned wanting to create computer players with different strategies to compete against each other. After running the game several times I could analyze the output to determine the optimal strategy. What I ended up making was a game for four human players. While fun, it wasn’t as useful for strategy analysis. And I also wanted to allow a single person to play against three computer opponents.

With that in mind I updated Monopoly in Excel with the added option of specifying human or computer players. The computer players are randomly assigned a “personality”, which dictates their strategy as follows.

  • Aggressive: Always tries to buy property, builds houses and hotels on the most expensive property as much as they can as soon as they can, will accept any trades that result in a net monetary gain
  • Restrained: Will buy or build as long as there is $500 on hand afterwards, builds on the cheapest property
  • Basic: Randomly decides to purchase properties or accept trade offers
  • Complex: Prefers to buy and build on properties between the “Jail” and “Go to Jail” spaces, won’t accept trades that result in a monopoly for an opponent (unless they receive one as well)

There is more logic than what is mentioned here about when to offer or accept trades, when to pay to get out of jail, etc. I invite you to look into the code for more detail if you are interested. All of the computer player logic is in its own module to keep it cleanly separated from the rest of the game mechanics.

This allows for a single player game against three computer opponents. However, I didn’t want messages to pop up for each computer interaction (e.g. when one computer player owes another rent). To get around this I added a three-way button for messaging. When set to OFF no messages will be displayed unless they require a human player’s input (like decisions to purchase a property, pay to get out of jail, or accept a trade). The ON setting displays every message. Finally, the PERSON setting will only show messages that pertain to the human player(s), even if they require no input (e.g. when a computer player pays a human player rent).

Allowing for any combination of human and computer players means that it can now run games with all four players controlled by the computer. This means it is possible to analyze who wins and loses based on their personalities and come up with an optimal strategy. To help with this the game logs every action in an output text file. This can be read later for analysis as a play-by-play on how a game went. If so inclined, you can edit the computer reaction logic, or add a new personality and test its effectiveness. Or you can just play some Monopoly. Enjoy!

  1. milkcold reblogged this from okayandrew
  2. generalbesh reblogged this from okayandrew
  3. arluine reblogged this from okayandrew
  4. amis127 reblogged this from okayandrew
  5. okayandrew posted this