MAIN Home Schedule Registration Rules About Language RESULTS Standings Problem Set LINKS LSU Computer Science Contest Index HS 2000 ACM Intl PC PC2 THANKS Sponsor Schools Volunteers
| | Brownopoly
Problem: Dr. Brownian spent a short career as a board game designer. The rather
simple game below is the result of his efforts (as you look at this rather weak
"clone", you will understand why his career was so short).
General rules:
-
Both players start on the location marked "Go" and start with $1500; player
1 is always the first one to move.
-
The players take turns "rolling" two six-sided dice and moving clockwise
the number of spaces indicated by the dice (i.e. the sum of the two dice).
-
If a player rolls doubles, he or she moves as usual, but does not give up
the turn; instead, the player rolls again and moves as before.
-
If a player rolls doubles for the third time in a row, he or she immediately
moves to "Jail" (do not pass "Go", do not collect $200) regardless of the
value rolled and the second player proceeds to roll and move as usual.
-
At any instant during the game, the amount of money a player has will never
go below zero or above $32768.
Special locations on the board:
-
Every time a player lands on or passes "Go" (except when sent directly to
"Jail") he or she gets $200. Neither player gets $200 for being initially
on "Go" when the game starts.
-
If a player lands on "Go to Jail", he or she immediately moves to "Jail"
(even if doubles were rolled) and the second player proceeds to move
as usual.
-
If a player lands on the space marked "Jail" directly (i.e. without first
landing on "Go to Jail" or rolling doubles three times in a row) then nothing
happens and the space is treated just like any other.
-
If a player lands on "Tax" then he or she immediately pays $42.
-
Every other space on the board besides "Go", "Jail", "Tax" and "Go to Jail"
has no special meaning.
Getting our of Jail:
-
A player's turn ends when sent to "Jail" and the second player proceeds to
move as usual; when it is once again the first player's turn, he or she rolls
the dice and if doubles are rolled the player moves the number of spaces
indicated by the two dice, but does not roll again and move on the
same turn as is the normal case for rolling doubles; if the player does not
roll doubles then he or she remains in jail for that turn and the second
player moves as usual.
-
If on the third attempt, the player in jail fails to roll doubles, he or
she pays a $42 fine and then moves the amount of spaces indicated by the
dice.
Input: The first line of the input will contain an integer between 0 and 1000 inclusive
that indicates how many different games of Brownopoly your program will simulate.
Each game will start with a count of how many dice rolls are in the game followed by
each of the dice rolls (one dice value per line). All input will be legitimate
(count will be valid, dice rolls will only be numbers between 1 and 6 inclusive.
A game could end at any time.
Output: For each game, the program should print how much money each player holds
at the end of the game. Separate the outputs of each game by one blank line.
Sample Input:
2 number of games
3 number of dice rolls for first game
4 roll 1, first die
4 roll 1, second die
1 roll 2, first die
3 roll 2, second die
5 roll 3, first die
1 roll 3, second die
2 number of dice rolls for second game
5 roll 1, first die
4 roll 1, second die
4 roll 2, first die
3 roll 2, second die
Note: The items in italics are here to help you understand the data. Your real input will only have numbers.
Sample Output:
Player 1: $1458
Player 2: $1500
Player 1: $1500
Player 2: $1500
|