CIS 223

Assignment 8-S97
Monopoly Simulation Project

Reading: Carrano, Chapters 1 and 3 (review) and Chapter 8. See also, the Anthology, Section 8, which contains the specifications (Rules) for the game of Monopoly. You will need to fully understand these rules to proceed with this assignment.

Topics and Concepts: Group work on a relatively large project -- including definition of group and individual responsibilities and the importance of regular communication; use of state transition diagrams to model the behavior of a program system; thorough and precise definitions of component interfaces; use of electronic communication media (e-mail, phone, ftp, etc.); data driven analysis, decomposition, and design of a larger project; separate component and integration testing; incremental programming (or programming by iterative enhancement); inheritance, virtual and pure virtual functions.

Project: You are to write a simulator for the game of monopoly. The simulator should work for any number of players from 2 to 8 to be chosen by the user. You are to omit all details concerning the exchange of money, except, perhaps, for the purchase of property and payment of rent. Furthermore:

  1. The actual implementation of the draw cards is optional.
  2. Buying of hotels and houses is optional.
  3. The decision of a player as to whether or not to purchase a property should be based solely on whether the player has enough cash on hand. Bidding to allow other players to purchase a property is optional.

Numerous issues concerning the modeling of the real objects used in the game and of the possible sequences of actions associated with a single move of a player will be discussed in class. It is now time to begin to add some meat to the bones.

I will provide you with some project milestones. We will attempt to solve this problem one step at a time. Considerable planning and a commitment to documentation and verbal and written communication will be required if you expect to complete this project in a timely manner. You will find it useful to first carefully analyze the problem specification (Monopoly Game Rules) and then work on the structural design of your simulator. Only after this has been done should you even begin to think about the C++ implementation.

Phase 1 -- Problem Analysis: (Due date to be specified later)

In building the simulator, we will work hard on identifying the problem domain entities that might be modeled, and in defining for inclusion in the model the essential characteristics of and operations on these entities. Here is how this might be done ...

Your team should meet as soon as possible and begin reading through and studying the Rules of the game. I strongly urge you to actually PLAY the game as part of your analysis. Below is a list of some of the written outcomes (documentation) of your analysis effort.

  1. A listing of the problem domain entities (the game board, players, properties, draw cards, etc.) that have to be manipulated when the game of monopoly is played.

  2. For each entity identified in 1), a list of the attributes (characteristics) of and the operations (methods) on that entity. The operations will fit into one of two categories -- those that

    The attributes and operations together will provide a static model of your system, illustrating the structure of each problem domain entity and its relationship to other entities at any given point in time. Initially, our static model will be described mostly in English, at a fairly high level of abstraction. Eventually, we will translate this more abstract model into a C++ class using the data types and operations at our disposal in the language.

  3. A state transition diagram providing a dynamic model of the states and related events for one class of objects (such as the players of the game). This diagram should show all of the possible states that can be reached as a result of a player's turn as well as the events that can lead to each of these states.

    An initial list of entities and entity attributes probably can be formulated without playing the game. However, the development of the state transition diagram for an object class and the list of operations required on each entity may be pretty difficult to construct without experience in playing the game and documenting the operations and state transitions as they occur.

    Some other issues:

Suggestions: The entire team should work together to be sure all members understand how the board and other entities will be modeled, and how that states of the problem domain entities and the game events interact. You should also work together on the details of the entity models and the state-transition diagrams. Your focus in this phase should be almost exclusively on data and state transition modeling at a high level of abstraction. I will try to provide you with a few examples of how to format this information (without overwhelming you with additional reading).

To Be Turned In: 1) List of problem domain entities each with a detailed list of attributes and operations. These lists should be entered on the computer using either a word processor or a simple editor. 2) Complete state transition diagrams for a player. Again -- I will try to provide examples before you start putting anything on paper.

Phase 2: Simulator Design

In defining the primary components of your simulator, the main focus should be on the data type models constructed as part of Phase 1. At this point your group should begin to think about partitioning set of all of these components into 3 subsets, and allocating each subset to a member of the group. The game should be replayed again, at least in part, with each member of the group responsible for adding to and refining the attributes and operations for the entities type models assigned to him or her.

You might consider dividing up your type models work as follows:

Additional type models you may wish to divide up include the representation of the dice, houses and hotels, the bank, etc. You may also want to charge one member of the group with implementing a user-friendly graphical interface for your simulator (perhaps even with a few sounds). This should be deferred until at least some part of your simulator is working and ALL OF YOU have had a chance to discuss what you want implemented and how it will be done,

At this point, the group needs to begin to map out a description of the responsibilities of each member to the others.

The mapping of each entity model to a C++ class can now begin.

  1. A model of each entity attribute should be constructed using either the built-in C++ data types, or additional user-defined data types.

  2. Additional detail should be added to the description of each operation. The detail should include:

    You may well have just three public methods for each type, a constructor (with appropriate initialization), destructor, and an "action" operator. There may be many other functions defined, but these will be private to the class (called by the "action" function)

  3. A list of possible exceptions (special situations or errors that can occur for the objects of your type) and the actions to be taken for each. You may never actually handle all of the exceptions that you note, but every exception that comes to mind should be noted.

  4. A list of any assumptions that you need to make along the way. (In our case these assumptions will usually be of one or two kinds:

NOTE: Chapters 12 and 14 of the Friedman/Koffman text contain some small examples illustrating how some of the above information might be documented. It is advisable to automate these lists so that they can be updated as needed and e-mail to your group members and/or printed. All three team members should try to adopt a similar format for describing his/her types.)

To Be Turned In: Complete printouts of the documentation provided for items 1) - 4) listed above.

Phase 3 - Component Implementation and Testing:

Each member of your group team is responsible for implementing, compiling, and testing the classes designed in Phase 2. Each member of the team should test a class that someone else designed. I will not insist on this, but it might be an useful exercise. To test your class, you will need to write a special driver program to test the constructor and all other functions of the class. You should also update the lists from Phase 2 and star (use an asterisk, *) any changes in these lists.

NOTE: You should NOT try to code any class all at one time. Rather begin by coding a small "nucleus" of attributes and methods. Get these compiled and tested, and then incrementally add more attributes and methods and test these. Repeat this process until you have a complete class as described in your Phase 2 lists. You may even wish to complete Phase 4 (below) before adding additional features to your components.

To Be Turned In: Your driver programs, the code for each class implemented, and your revised lists from Phase 2.

Phase 4: Integration Testing

Integrate all components developed in Phases 1-3 into a single program and complete the code for and test this program. You should keep a log of ALL major problems encountered during integration. Turn in your final code, your log, and a reasonably informative trace of the execution of your program for perhaps the first 100 player moves.

To Be Turned In: The output from your system integration test and your Problem Log. A "live" demonstration of your simulator in action would be appreciated.

Phase 5: System Enhancements (as time permits)

Review your list of not-yet-implemented features and repeat Phases 2-4 for each of these features, enhancing the relevant models and classes, implementing the enhancements, and finally repeating the integration testing step outlined earlier.

To Be Turned In: The output from your system integration test and your Problem Log. A "live" demonstration of your simulator in action would be appreciated.

Return to Previous Page