GUTSY is a table game for two or more players. It aims at getting 101 points by throwing a die
while overcoming the one dot rule, and not being so greedy. Each player, at a turn, can throw the
die and accumulate the obtained points, but if s(he) gets one dot (one point), the accumulated points
in that turn are lost (zero points).
The rules are:
• The player can throw the die as many times as s(he) wants and stops when s(he) decides.
• Each time the die is thrown, the points are accumulated.
• Once a player decides to stop, his/her accumulated points count towards the goal of 101
points. The turn goes to the next player.
• One dot rule: If the player gets one dot, s(he) does not get any point (zero) to be
accumulated towards the goal, and the turn goes to the next player.
• The player who gets 101 or more points wins.
PROBLEM STATEMENT
Your Gutsy solution must play this game automatically and produce its statistics. We will need to
collect statistics as follows:
• Probability of getting one dot.
• Probability of getting two dots.
• Probability of getting three dots.
• Probability of getting four dots.
• Probability of getting five dots.
• Probability of getting six dots.
• Average number of times the die is thrown to get a defined accumulated value.
• Average number of times the die is thrown to get 101 or more (to win).
In order to deal with the statistics, your program is required to have the following function/methods:
• The main() function that controls all of the others.
• A function, playGutsy, that prompts the user for the number of Gutsy players and the
number of games they will play. This function stores the results of the games and required
statistics in one or more appropriately-sized array(s). The computer will play the given
number of games without human intervention, but before, it will ask the user for information
regarding each player:
1. Name of player,
2. Minimum number to stop a turn on the die (defined number).
• A function that throws a die several times in order to reach and accumulate values up to the
defined number, and returns the accumulated value or zero (in case a one dot is obtained),
number of times the die was thrown, and counters required for the statistics. Suggested
function signature: void dieThrown( int dNumber, int *accumValue, int *numTimes, int
*count1to6[]).
• A function that plays a turn for a player by using the previous function and accumulates the
value towards the goal and statistics. This function returns if the player has won. Suggested
function signature: int playerTurn( int player, int accumValue, int *playerTotal, int
*numTimes101).
• A function that prints out the player name, defined number, accumulated value and total
points. Suggested function signature: void playerPrint( int player, char playerName[], int
dNumber, int accumValue, int playerTotal).
• A function, displayTable, that displays (prints out) all totals per player at the end of a round
turn (scores table). This table will be displayed at the end of each game, as well as at the
final results.
• A function, statistics, that stores statistical values accordingly in order to calculate them at
the end of the games.
• A function, statisticsTotal, that calculates and displays (prints out) final statistics. for the
following questions:
1. Probability of getting one dot, P(1). P(1) = # times one dot / # times thrown die
2. Probability of getting two dots.
3. Probability of getting three dots.
4. Probability of getting four dots.
5. Probability of getting five dots.
6. Probability of getting six dots.
The sum of these probabilities should total 1.
7. Average number of times the die is thrown to get the defined accumulated value (per
player).
8. Average number of times the die is thrown to get 101 or more (to win).
• A function, sortPlayers, that sorts alphabetically the players.
GUTSY GUI
A message with instructions must be displayed at the beginning of the program. After this, the
computer will ask:
Please type in the number of players: 2
Please type in the number of games: 10
Take into account that these inputs must be valid as they must be positive values and greater than
zero. Then the computer will ask:
Player 1:
Name: John
Minimum number to stop in a turn: 10
Player 2:
Name: Mary
Minimum number to stop in a turn: 15
The user can use lower case or upper case for inputs, but the program will always convert to upper
case. Once information from the user is gathered, the computer will start the automatic game.
***** GAME STARTING *****
The program will then take the turn for player one and at the end of the turn will display:
Game 1
Player 1 – John:
Minimum number to stop in a turn: 10
Points obtained: 12
Total points: 12
And then will continue with player 2, displaying:
Player 2 – Mary:
Minimum number to stop in a turn: 15
Points obtained: 20
Total points: 20
Then a table will be displayed as follows:
Game 1 - Table
Player Turn points Total points
John 12 12
Mary 20 20
Current winner: Mary
Following, the program will continue all turns while storing the required values for the statistics. At
the end of this game, when one player has reached 101 or more points, it will display:
Game 1 - Table
Player Turn points Total points
John 14 103
Mary 0 98
***** Winner: John *****
Game 1 – Statistics
P(1) = 0.0600
P(2) = 0.2300
P(3) = 0.2400
P(4) = 0.1600
P(5) = 0.1900
P(6) = 0.1200
John – A(15) = 4
Mary – A(20) = 5
A(101) = 22
Then the program will continue playing the following games and displaying as presented above. At
the end, it will display again the final table and statistics (similar tables as presented above), but
sorted alphabetically.