Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Very short description: Write a program that allows the user to play the dice game Fifty More detailed description: Your computer program should allow 2

image text in transcribed
image text in transcribed
Very short description: Write a program that allows the user to play the dice game Fifty More detailed description: Your computer program should allow 2 players to play the dice game Fifty. The rules for Fifty are as follows: Goal: The goal of Fifty is to be the first player to reach 50 points. You get points by rolling doubles Play: The players decide who will be player l and who will be player 2. Player l goes first. A tum consists of a player rolling a pair of dice (with the goal ofrolling doubles), and scoring the roll as described below. Play continues with each player taking one roll per turn. The first player to score 50 or more points is declared the winner. Scoring: All doubles except 3s and 6 score 5 points. Double 6s are worth 25 points. Double 3s wipe out the players entire score, and the player must start again at 0.Non-double rolls are 0 points The program should allow the users to continue to play the game until they choose to quit. Note: As you are developing and testing your program, you might want to make the winning score something smaller than 50, such as 10. It can take a while to reach 50 points. Just be sure to change it back to 50 before turning in the program. To simulate the roll of the dice, the program must generate a random number from l to 6 for cach dic. Each of the random numbers is the value for cach die. To generate a random number, C provides the rand() function. However, this function is a pseudo-random number generator. The very first time the rand() function is called, it will come up with the same number (not exactly what you want). Therefore, to give the rand function a different starting point each time, we can initialize the random generator with the time0 function. which returns the number of seconds from the system clock. In other words, do the following at the beginning of your program srand((unsigned)time (NULL)) seed random function with current time only needs to be done once You need to include stdlib.h (i.e.. ainclude

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions