Description
The Monopoly 2
In this homework, you are going to enhance the Monopoly game that you
implemented in the previous homework. The following features will be added:
• Playing Against Computer
• Board Implementation
• Fortune Cards
Gameplay Rules for Computer:
(Unless it is told, actions are the same as user actions defined in the
previous homework.)
• When played against the computer, it rolls a dice just like a user.
Dice rolling result for the computer must be printed as “Computer
rolled the dice: N”.
• If computer arrives at an unowned property, it decides what to do
based on the followings:
o If the price of the property is below the average cost of all
properties, then computer must buy the property.
o Otherwise, the computer rolls the dice again. If the outcome is
between 1 and 3, then the computer must buy the property. If the
roll is between 4 and 6, the computer skips its turn.
• If the computer lands on a property it owns, it may construct up to 3
houses on that property. The number of houses it can built depends on
the number of properties it owns:
o If the computer owns 1/3 of all the properties, it rolls a dice.
If the result is between 1 and 3, then the computer constructs a
house. Otherwise, it skips the current turn.
o If computer does not have 1/3 of all his properties, it skips
its turn.
• When computer does not have enough money to pay its rent/tax, then the
bank asks it to sell some of its properties. The computer must sell
starting with the highest priced property till it pays off its dept.
• Player_type for computer is “cap”. Update your implementation
accordingly.
Board Implementation:
• You must convert your array-based board implementation to a linked
list.
• There are 4 more blocks added to the board. The total number of blocks
on the board now is 24.
CSE102 – Computer Programming Homework #5
Page 2 of 2
Fortune Cards:
• Whenever a player lands on a fortune card block, player draws a card
from fortune card deck (you randomly pick a fortune card). It carries
out the action the card says.
• Location of fortune card blocks on board are defined in the
blocks.xlsx file.
• Block type is “fortune”. You must update your block_type enumeration
implementation accordingly.
• Define a struct with name “fortune_card”. Rest of the implementation
is up to you.
• Fortune cards are defined below.
Card No Fortune Card Name Explanation
1 Free House Build a house on one of your properties for
free.
2 Time Travel Roll a dice. If result is [1-3], move forward
by 2 blocks. Else, move backward by 2 blocks.
3 Garnishment Pay 5.000 to the bank.
4 Generosity Give 10.000 to the opponent.
5 Treasure Hunter Take 20.000 from the bank.
General Rules:
1. Unless otherwise noted, the given function prototypes should not be
modified. If you do so, you will get zero credit for that part of the
assignment.
2. Note that if any part of your program is not working as expected, then
you can get zero credit for the related part, even it partially works
for some cases.
3. Upload your .c file on to Moodle to deliver your homework.
4. You can ask any question about the homework via Moodle Forum. But
please do not post answers and part of the answers. Those post
revealing solutions to the entire or a part of the assignment will be
treated as cheating.
5. Solutions including cheating will get –100. Cheating means that a
solution is copied from another source (from the internet or another
student) without substantial contribution of your own. Changing
variable or function names or re-ordering portions of the code does
not constitute as substantial work. In the case of copying between two
submissions, there will be no distinction as to who the source is.
They will both get –100.
Corresponding TA: M. Rasih ÇELENLİOĞLU (mcelenlioglu@gtu.edu.tr)