Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
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.
Posted
Updated 3-Jan-16 22:13pm
v3
Comments
Where is the exact problem in code?
Member 12202551 28-Dec-15 22:53pm    
i haven't start yet .... i don't know how and where to start .... sorry
PIEBALDconsult 28-Dec-15 22:42pm    
A very uninteresting game. It is unlikely to attract any "help".
Sergey Alexandrovich Kryukov 28-Dec-15 22:44pm    
Agree, very boring.
—SA
Member 12202551 28-Dec-15 22:57pm    
but i want help, i don't know how i can start to write codes .... which code i should use

It is a complex task a "big project". If you want to make a software of this, you must start to develop a model (some objects with the actual state) and implement every of your rules with ONE function. Important is also a clear graphical presentation and some save/read operations for the actual state in text files.

Use enums for different states - it is pain at the start but helps avoiding annoying bugs.

If you know about UML you should use it, especially if it some important homework. Else make some sketches on a paper to better understand the problems.
 
Share this answer
 
Comments
Member 12202551 29-Dec-15 23:42pm    
thanks
KarstenK 1-Jan-16 13:47pm    
You really should start with some thinking and skteching on paper for some hours. It feels like waisting time, but you can clearer understand which solution you want to develop.
Member 12202551 7-Jan-16 4:45am    
thanks
Start by writing most trivial functions like playerPrint and ensure those works.

The write other functions by starting with those that are simpler and do not depends on other functions not yet implemented.

Also write all required functions prototypes and provide an empty/minimal implementation of those.

Then draw diagrams of the state machine so you have a visual representation of what it should do.

Then implement remaining functions...

As there is a lot of information in your homework, you should be able to do a lot even before needing any help.

In any case, it is much better to do it yourself as you will learn much more.
 
Share this answer
 
Comments
Member 12202551 29-Dec-15 23:42pm    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900