This is a python application used for analyzing the statistics of a monopoly game. This application can either be used for simulating a single game of monopoly, gathering data from thousands of simulated games or finding ideal gameplay strategies.
- This program uses graphics to display game board and data
- This program also uses colour to color code the data with a gradient
- simulate(): This method simulates a game of monopoly. If turnByTurn == True, the game board is displayed on the graphics display and clicking the screen advances the game.
- simulateMany(n): This method simulates n number of games. At the end, statistics are displayed on the game board.
- drawBoard(): This method draws the game board. This is used to display turn information or statistics at the end of a multi-game simulation
- findStrategy(): This method changes key variables to track the best strategy for the best odds of winning.
- displayWinLossTieRatio(): This method displays the win/loss/tie ratio. Displayed in the center of the game board.
- displayPercentLandedOn(): This method displays the percent each property was landed on. Displayed on the bottom row of each property.
- displayLostOnProperties(): This method displays the percent of the time a property was lost on. Displayed on the bottom row of each property.
- displayLosingProperties(): This method displays the percent of the time a player who placed second owned each property. Displayed on the bottom row of each property.
- displayWinningProperties(): This method displays the percent of the time a winner owned each property. Displayed on the upper row of each property.
- displaySpecificGame(): This method allows the user to display the ending of a specific game played in a multi-game simulation.
-
Certain parts of the code can be edited to change modes and the starting conditions of players. These parts are clearly indicated in main(), surrounded by # symbols.
############### Edit Values Below ##############
values
################################################
Values:
- numPlayers: The number of players in the game
- turnByTurn: Set as "True" for a single game simulation. False for a 10,000 game analysis
- turnSkip: During a single game, this determines how many turns are played after each mouse click
- playerMoneyList: The starting money for each player
- propertiesOwnedList: Properties owned for each player
- posList: The starting points for each player
- masterHousesList: The number of houses on each property
- For example: masterHousesList[9] = 4 would put 4 houses on the ninth square (Connecticut Avenue)
- masterMortgageList: The number values of all mortgaged properties
- middlePot: The amount of money in the middle pot
-
Gameplay information:
- Circles: Represent the players
- Colored numbers below property names: The player who owns the property
- Red M on the bottom right of property names: Indicate that a property is mortgaged
- Green number on the bottom left of property names: Indicate the number of houses on that property
- Red "J" on "In Jail": Indicates whether a player is currently in jail (rather than "just visiting")
- Center: Displays other gameplay information - player money, dice roll, middle pot, chance/community card values
-
Upon completion of many games:
- Upper numbers on properties: Represents the percent of winners who owned the property
- Lower numbers on properties: Represents one of many statistics
- Percent of the time the property was landed on
- Times the property was lost on
- Percent of the time a player in 2nd place owned the property
- Middle-Top: Percent of properties owned by winner and second place
- Middle-Bottom: Percent wins, losses and ties for each player
Before roll
- Unmortgaging: If the player has the money, try to unmortgage properties - prioritizing properties with houses
- Houses: If the player has a monopoly and $200 more than the cost of a house, try to build as many houses as possible
After Roll
- Jail: If the player is in jail, try to get out in this order - get out of jail card --> pay $50 --> roll for doubles --> if player has rolled 3 times, automatic
- Doubles 3 times: If the player rolled doubles three times, go to jail
- Snake eyes: If the player rolled double 1s, get $100
- Landing on go: Get extra $200
- Landing on/passing go: Get $200
- Landing on "Go to jail": Go to jail
- Landing on "Free Parking": Get middle pot ($500 plus taxes payed to the middle)
- Landing on "Chance" or "Community Chest": Follow instructions on the card
- Buying properties: If the player has the money and lands on an unowned property, buy it
- Paying rent: If the player lands on an already owned property, pay the rent
- Paying taxes: If the player lands on a square that requires taxes, pay the taxes
- Mortgaging: If the player has zero or negative money after paying, mortgage properties - prioritizing properties without houses
- Losing: If the player has zero or negative money at the end of the turn, the player loses and properties are returned to the bank.
- Winning: If there is only one player at the end of a turn, that player wins
- Tying: If the game has been played for 1000 turns without a winner, the game is called as a draw
- In a three person game without trades, about 50% of games end in a stalemate
- Starting out with the dark purple/brown monopoly and building on it immediately significantly reduces your odds of winning. The lack of money at the beginning is far worse than the slight benefit of the purple monopoly
- However, starting with and building on any other monopoly is beneficial
- Properties that winners tend to have does not seem to directly correlate with the most landed on properties
- Boardwalk is the most common property owned by winners
- The dark purple/brown properties are least likely to be landed on and among the least common owned by winners