Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Topics: UNIX and C Programming Game Specification: Write a C program that allows a single Player (the user) to play a simple three dice game

Topics: UNIX and C Programming

Game Specification:

Write a C program that allows a single Player (the user) to play a simple three dice game of chance against "The Odds".

There is a single player, with three eight sided dice.

The sides of each die are labeled with the numbers from 1 to 8, we will call this the value of the die.

A game is made up of rounds, a single round is played as such:

The player rolls their three dice

The dice are displayed, in some reasonable format.

A determination is made as to whether or not the player won the round, this determination is made via the following rules:

i.A Triple is when all the dice have the same number on their top faces. If the player has any Triple then they win the round.

ii.A Straight is when the numbers on the three dice faces can be arranged to form a consecutive sequence like or If the player has any Straight then they win the round.

iii.A Pair is when any (exactly) two dice have the same number on their top faces. If the player has any Pair then they neither win nor lose the round.

iv.A Junker is then anything that is not a Triple, a Straight or a Pair. If the player has any Junker then they lose the round.

The result of the round (with respect to the Player) is reported.

The player is asked if they wish to play another round.

Once the player indicates that they do not wish to play another round: Before exiting, the program displays a short report stating how many rounds were played, of those - how many were won and how many were lost.

Outline:

Create a text file in your UNIX account program10.c

Edit your program10.c file to contain your C source code

Save your program10.c file

Compile your program10.c file (repeating steps 2 4 until it compiles without error)

Run / Test the resulting a.out file

You really need to run your program a number of times to do this thoroughly

Repeat steps 2 5 until it runs correctly

Notes(s):

Make sure to include and

Use (rand() % 8) + 1 to generate the die values

Your .c file will be many lines long

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago