This game is taken from an example I found on the internet by Charlie Jans (removed link because website no longer works). However, I completely reworked it so that the code is more robust. It has four players and has a lot more functionality in some areas.
Using the Ribbon Buttons
To reduce clutter on the screen, I decided to add all actions performed into the ribbon as shown in the next screenshot. This ribbon menu gives you access to start a new game, roll the dice, buy/sell houses, mortgage/unmortgage property, offer deals to other players, change the board name between five different editions, or save and close at the click of a button. Computer players will automatically perform all these actions. Some buttons are only enabled when the player has met the minimum requirements to perform the given operation. For example, buying houses is disabled if the player doesn’t own a monopoly.
Playing the Game
Game play starts by entering the number of players (from 2 to 4 players) which will clear the board if needed. If you want to change human players to computer players, click the cell that says "Player #" at the top of a player’s property list. To roll, click the "Roll Dice" button in the middle of the board or in the excel ribbon. If the next player is a computer it will automatically roll. After purchasing property, the property will show up in the player’s property list and mark the land tile as "Sold P#." If the property is already sold it will deduct the rent owed. If the space isn’t property, appropriate action is performed such as drawing a community chest or chance card. Mortgaging or unmortgaging property will change the status back and forth from "Sold P#" to "Mort P#" and mark it red if it is mortgaged. Buying houses/hotels will place a house shape on the board.
Buying Property
When a player lands on a property that isn’t owned, this following window will pop up giving the player the opportunity to purchase the property or put it up for auction:
If the player decides to purchase the property, the title deed will pop up displaying details about the property such as rent, cost of houses, and mortgage value. Rent is highlighted in red. If a player owns a monopoly without houses, the value will double except on railroad and utility spaces. Instead, the rent value for these spaces will change based on quantity owned. See below for sample property deeds:
After a player owns property, he/she can double-click the property name in their property list and it will display the title deed once again.
Auctioning Property
If the player declines to purchase property or lack funds, the property is auctioned off. The window below pops up (see below) where the player after the one who declined the property starts the bid. The starting price is at half the value of the property. The bidder can increment the current bid by as much as they want. If a bidder passes, their status changes from "Active" bidder to "Passed." After all but one bidder passes, the last bidder wins the bid and receives the property at the "Current Bid."
Forced Mortgage or Selling Houses
In the case that the player owes more cash than they have, a window will pop up presenting options to either mortgage property, sell houses, or declare bankruptcy by quitting. By clicking on "Mortgage Property" a window to mortgage property is shown as discussed in the next section. If the player doesn’t have any houses, then the "Sell House" button is disabled. In the event that any player declares bankruptcy, all property, cash, get out of jail free cards, etc. shift from the bankrupt player to the player where rent is owed. If rent is owed to the bank, all property goes back to the bank.
Mortgaging/Unmortgaging Property
When a player opts to mortgage or unmortgage property whether by choice or not, the mortgage window is made visible (see below). In this window there are two pages: a mortgaging page and an unmortgaging page. The player decides which property they want to mortgage or unmortgage. After doing so, the window is refreshed to show current property status. When a property is mortgaged, the font of the property is set to strikethrough. By mortgaging, the player adds the mortgage value to their current cash. When unmortgaging, the player will be charge a 10% interest fee.
Trading Property
Anytime during the game when two players have property, a player can propose a trade as long as they are one of the two players with property. By proposing a trade the window below opens and loads the player’s property in the left side of the window. The player can then select a player to trade with and it populates the other player’s property in the right side of the window. Property can be selected for trade and multiple selections can be made as shown in the screen shot. Additionally, the player can designate a certain amount of cash they offer or demand with the trade. After all fields are filled, the player then clicks "Offer" which will proceed with the offer.
The player making the offer is then prompted to confirm the offer is correct before sending the offer to the other player as shown in the screen shot at the bottom right of this page.
After the player makes the proposal, the recipient receives the offer as shown in the window below. If the player is a computer, everything is handled in the background and the computer will accept or reject the offer. The recipient player can evaluate the offer and decide whether or not they accept or decline the offer. If the offer is declined, the offering player is notified that the offer was rejected.
Buying and Selling Houses
Buying and selling houses or hotels on property is set up very similar to the "Mortgage Property" window. When a player has a monopoly they can purchase houses or hotels (see below). Houses are purchased at the cost shown. Every time a building is purchased, the window is refreshed so the player has to build houses and hotels evenly. After purchasing a house or hotel, it is placed on the board as shown in the image below as a green house or a red hotel.
After building houses or hotels on property it updates the property title deed as seen below. Since Board Walk has a house built on it, the line about owning one house is colored red.
Getting Out of Jail
Whenever a player is in jail, when they roll the dice the window to the right opens and prompts the user to either use a chance or community chest card if they have one, pay the $50 fine, or roll the dice in attempt to roll a double. After three rolls of no doubles, the player is forced to pay the fine and leave jail.
The get out of jail free cards are shown in the player’s property list right next to the cash.
Extremely amazing and impressive. Best version of this I've seen. One thing I noticed was after buying houses the activity log shifted down and over, Park Place Lost its color, and a house icon appeared above the player 1 property list area. Then after mortgaging houses the log disappeared altogether. Just wanted to make you aware. Love it!
- August 09, 2023 12:05 PM by SHAIN MEYERS