程序代写代做代考 What to submit

What to submit
● All of your .cpp and .h files that make up your solution
● A makefile to compile your .cpp and .h file into an executable named ​hoarding.out

Description
● Update your solution to use inheritance for your spaces
● Add the following spaces to your gamel

○ Free Parking
○ Pay Bank
○ Jail
○ Go To Jail

Using Inheritance for your Spaces
Time it took Matthew: 3 hours

Feature Description
● You must update your solution to use inheritance for your spaces
● You should have a base class called Space
● Your Go Space and Property Space, as well as the new spaces that you are adding

must inherit from Space

Required Members and Methods and Members
● The required method in your space class are ​void Space::activate(Player&

activatingPlayer) ​and ​void Space::display() ​.
○ You may have more members and methods than these but you must have at

least these
● Space::activate(Player& activatingPlayer)

○ This method should be pure virtual
○ This method is responsible for handling what happens when a player lands on

this space
● Space::display()

○ This method is responsible for displaying this space to the screen

Updates to the Board
● Your Board must now be made up of a ​std::vector

>

● You may ​NOT​ dynamically allocate Spaces using ​new

Limit Checking of Types
● In your solution you must limit checking what the type of a space is using

dynamic_cast ​ or other methods (such as storing the type of a space within a space
and checking that)

● You will probably have to do some checking on the type of a Space but excessive
checking of the type will result in a 50% credit deduction on your submission

● To give you a rough idea of how limited checking should be, I had to check types about
3 times in my solution

○ Once to get the ​GoSpace
○ Once to form my property sets
○ Once to convert a space to ​JailSpace ​so as to check how much money it took

to pay your way out of Jail

Hints
● Converting to using inheritance is the most time consuming part of this homework

○ Once you’ve done it adding in the new spaces is pretty easy
● You might also consider using inheritance for your Moves

Free Parking
Time it took Matthew: 10 minutes

Feature Description
● When a player lands on Free Parking they collect any money that is in Free Parking

○ If there is money in Free Parking you should tell the player how much money
they received for landing on Free Parking

○ If there is no money in Free Parking don’t tell the player anything
● There can be multiple Free Parking Spaces

○ The money in the Free Parking Spaces is pooled between all the Free Parking
Spaces

Format in the Board File
● A Free Parking Space has the following format in a board file

○ Type, Name
● Type will be FreeParking

Pay To Bank
Time it took Matthew: 10 minutes

Feature Description
● When a player lands on a Pay to Bank Space they pay the bank the specified amount

○ If they player can pay this amount you should print the fact that they paid the
bank this amount for landing on this space

● If a player doesn’t have enough money to pay the amount owed they go Bankrupt
○ The process for going bankrupt is the same as going Bankrupt to a player

■ If they have upgrades on a property they have to sell to try and make up
the money that they owe

■ If a player does go bankrupt to the bank the bank takes back their
properties and they become unowned again

○ If a player goes bankrupt for landing on Pay to Bank Space you should print this
to the screen

● If the Put Money In Free Parking rule is enabled any money paid to the bank is instead
placed in the Free Parking money pool

○ Only money is placed in Free Parking if this rule is enabled
○ Properties are never placed in Free Parking even if the player goes bankrupt for

landing on one of these spaces

Format in the Board File
● A Pay to Bank Space has the following format in a board file

○ Type, Name, Amount to be Paid to Bank
● Type will be Pay

Jail
Time it took Matthew: 1 hour

Feature Description
● If a player lands on this space, they are considered Just Visiting, and nothing happens
● If a player is sent to Jail by a Go To Jail Space they are placed in Jail for the number of

turns specified by this Jail Space
● While in Jail the player can still choose to Upgrade/Downgrade properties
● At the beginning of a player’s turn, if they have money to pay the “Get Out of Jail” fee,

they are offered the opportunity to pay to get out of jail
○ If the user decides to pay this fee they are immediately released from Jail
○ If the user does not decide to pay this fee they remain in Jail

● If a user is in Jail when they go to roll the dice they stay in Jail ​unless​ they roll doubles
○ If they roll doubles they are immediately released from jail and their turn

continues like normal
○ If they don’t roll doubles they remain in Jail

● If the user has been in jail for the maximum number of turns, they must pay the get out of
jail fee

○ If they are unable to afford the fee the player goes bankrupt
■ Again the user can sell upgrades to help pay off their debt

○ Our behavior for leaving is slightly different than that of Monopoly’s
■ In Monopoly if you are sent to jail for 3 turns and on your 3rd roll to get out

you fail to roll doubles you would then pay the get out of jail fee and move
then number of spaces you rolled on that roll

■ In our version if you are sent to jail for 3 turns and on your 3rd roll to get
out you fail to roll doubles you remain in jail. On your next turn you would
then be forced to pay to get out of jail. Now since you are out of jail rolling
continues like normal

● If the Put Money In Free Parking Space rule is enabled then all money paid to get out of
Jail goes to the Free Parking Pool

● There can be multiple Jail Spaces on a Board

Format in the Board File
● A Jail Space has the following format in a board file

○ Type, Name, Turns spent in Jail, Amount of Money to Pay to get out of Jail
● Type will be Jail

Go To Jail Space
Time it took Matthew: 10 minutes

Feature Description
● When a player lands on this space they are immediately sent to the associated Jail

Space and placed in Jail
○ They should be told that they are being sent to the jail space and for how long

● They do not pass the Go Space and do not collect their Salary

Format in the Board File
● A Go To Jail Space has the following format in a board file

○ Type, Name, Index of Space to Go To
■ If index is 0 it means the first space on the board, 1 the second space, 2

the third space and so on
■ The index can be for a space that ​comes after​ this space so be sure to

take that into account when designing your solution
● Type will be GoToJail