A computer simulation of a board game must be a faithful representation of the elements and rules of the game. The basic elements of Monopoly include a board, the bank, cards, properties, and players. The interaction of these elements is governed by rules that dictate how each element may behave. For example, players who own properties can collect rent.
To represent game elements and rules, I designed the Monopoly simulation around programmatic objects. An object of this type has fields, which describe the object, and methods, which describe what the object can do. Methods often work by updating values in the object’s fields.
For example, a player object has fields that describe its status, like board position. Additionally, it has methods that describe the actions it can perform, like a move method that “moves” the player across the board by updating the field that describes the player’s board position.
As a second example, each of the 40 spaces in the board is represented by a programmatic object with fields that describe it (e.g., price, if it is a property). The simulation represents spaces as elements in an ordered list (e.g., Free Parking is the 20th space) that players traverse throughout the course of the game.
For the sake of simplicity, I designed space objects without methods. Any interaction between a player and a space is executed by a method in the player object. For example, properties do not have a collect method to extract rent from players who land on them. Instead, the player object has a pay method to compensate the property owners.
In sum, the simulation uses programming objects to represent the elements of the game as well as the rules that dictate how these objects can interact with one another. Programming objects afford the simulation an economical and intuitive way to represent the dynamics of Monopoly.