Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Instructions:
- Fly By Night Games Company was so impressed with your work on Chutes and Ladders they have hired you once again to supply a specialized version of Monopoly. Based on the buildings at Seattle University and with a simplified rule structure, you will allow two to six people to play the game.
- Each player begins with $1500 dollars to use in purchasing buildings.
- When a player lands on an owned building he/she must pay rent.
- The first space is called "Go" and when a player passes "Go" he/she collects a salary of $200 from the "bank".
- There are spaces containing items that cannot be owned - these direct a player to roll in order to select an action or to pay a fee (like Fee or Tax) or just allow a rest (like the Chapel of St. Ignatius).
- The game ends when one player is out of money - the winner is the one with the most money.
- Players move by rolling two dice and moving from 2 to 12 spaces around the board. Once a player reaches the last space, they return to "Go". If the player passes "Go", they collect $200 from the "bank" and do the following:
- If the player lands on an unowned building (designated by an owner = 0), they can choose to purchase the building or not (they must have enough money).
- If the player lands on a "Chance" location, they roll a single die
- A roll of 1, 2, or 3 gives them a bonus of $50.
- Any other roll moves them immediately to the Chapel of St. Ignatius or Office of Dean Quinn (whichever is closer) for a rest.
- Passing "Go" to get to the Chapel/Dean's office does NOT get the player $200.
- If the player lands on a building owned by another player (designated by that player's number), they pay the other player the appropriate amount of rent.
- If the player lands on "Income Tax", they pay $200 to the "bank".
- Track property ownership by way of an integer attribute where
- -1 means the building cannot be owned
- 0 means the building can be owned but currently has no owner
- any other number indicates which player owns the building
- The board information is stored in a file called "p4input.dat". The final program should connect to the file through a constant string so the input file doesn't need to be copied to each student directory, as in:
- const string FILENAME = "/home/fac/ohsh/submit/19wq1420/files/p4input.dat";
- The format for the file is:
- Name (string, may have spaces)
- Owner (integer, -1 for cannot be owned, 0 for no current owner)
- Cost to purchase (integer, up to 3 digits)
- Cost to rent or amount of fee (integer, up to 3 digits)
- and the file contents: P4: Input File Contents
- TODO:
- Use the instructor's starter code by copying the "p4.cpp" file into your working directory:
- cp /home/fac/ohsh/submit/19wq1420/files/p4.cpp .
- Note the dot (.) at the end of the line, after a space. There is also a space after the command "cp".
- Do not make any changes to the function prototypes included in the instructor's starter code; however, feel free to include any additional "helper" functions to ensure that all functions do one task and only one task.
- Complete the implementation of the following functions (marked by TODO):
- main
- fillBoard
- resetBoard
- playerSetup
- takeTurn
- checkSpecialLocation
- payRent
- buyProperty
- displayCashAndProperties
- Notes:
- When the user begins the game, read in the file to prepare the board (an array of structs).
- There will be no more than 45 spaces on the board.
- Ask for the number of players (only allow from 2 to 6) and request their names (an array of structs).
- For each player you must track their name, current position on the board, and the amount of money they still have (initialized to 1500).
- Let player 1 take the first turn; play proceeds in player-number order.
- As soon as one person loses all their money, the game ends.
- The winner is the one with the most money when the game ends.
- Allow the user to play again with a new set of players.
- number of players is between 2 and 6 and different names may be associated with these players.
- To compile your program, type:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement