Develop and implement an interactive two-player yahtzee game

Assignment Help C/C++ Programming
Reference no: EM13684908

Objectives:

At the conclusion of this programming assignment, participants should be able to:

Apply repetition structures within algorithms

Construct while (), for (), or do-while () loops in C

Apply pointers, output parameters, and/or arrays in C

Compose C programs consisting of sequential, conditional, and iterative statements

Eliminate redundancy within a program by applying loops and functions

Create structure charts for a given problem

Determine an appropriate functional decomposition or top-down design from a structure chart

Generate random numbers for use within a C program

Prerequisites:

Before starting this programming assignment, participants should be able to:

* Analyze a basic set of requirements and apply top-down design principles for a problem

* Customize and define C functions

* Apply the 3 file format: 1 header file and 2 source files

* Open and close files

* Read, write to, and update files

* Apply standard library functions: fopen (), fclose (), fscanf (), and fprintf ()

* Compose decision statements ("if" conditional statements)

* Create and utilize compound conditions

* Summarize topics from Hanly & Koffman Chapter 4 & 5 including:

* What are counting, conditional, sentinel-controlled, flag-controlled, and end file-controlled loops

* What are while (), do-while (), and for () loops

* What is a selection or conditional statement

* What is a compound condition

* What is a Boolean expression

* What is a flowchart

Develop and implement an interactive two-player Yahtzee game. Yahtzee is a dice game that was invented by Milton Bradley and Edwin S. Lowe in 1956. The challenge of the game is to outduel the other player by scoring the most points. Points are obtained by rolling five 6-sided die across thirteen rounds.

During each round, each player may roll the dice up to three times to make one of the possible scoring combinations. Once a combination has been achieved by the player, it may not be used again in future rounds, except for the Yahtzee combination may be used as many times as the player makes the combination.

Each scoring combination has different point totals. Some of these totals are achieved through the accumulation of points across rolls and some are obtained as fixed sequences of values.

You may design the Yahtzee game with functions that you see fit. I recommend that you start with a structure chart and determine sub-problems and functions accordingly. You must also take advantage of applying pointers, output parameters, and/or arrays! Your Yahtzee game must also implement the following algorithm:

(1) Print a game menu for Yahtzee with the following options:

1. Print game rules
2. Start a game of Yahtzee
3. Exit

(2) Get a menu option from the user; clear the screen

(3) If option 1 is entered, then print the game rules stated above and repeat step (1) otherwise if option 2 is entered, then continue on to step (4); player 1 starts the game otherwise if option 3 is entered, then print a goodbye message and quit the program otherwise repeat step (1)

(4) Ask the player to hit any key to continue on to roll the five dice

(5) Roll the five dice and display the face values of each die; enumerate each die with a number 1 - 5; add 1 to the total number of rolls for this round

(6) If the total number of rolls for this round is less than three, then ask the player (Y/N) if he/she wants to use the roll for one of the game combinations otherwise a combination must be selected

1. Sum of 1's 7. Three-of-a-kind

2. Sum of 2's 8. Four-of-a-kind

3. Sum of 3's 9. Full house

4. Sum of 4's 10. Small straight

5. Sum of 5's 11. Large straight

6. Sum of 6's 12. Yahtzee

13. Chance

(7) If the number of rolls is three or "yes" is entered, then save the combination and it may not be selected again in the future; continue on to step (8); clear the screen

otherwise if "no" is entered, ask the user which dice to re-roll (1 - 5); re-roll the selected die or dice; clear the screen; repeat step (6)

otherwise repeat step (6)

(8) Alternate players

(9) If each player has rolled for the round, then increment the round number if the round number is equal to 14, then continue on to step (10) otherwise repeat step (4) otherwise repeat step (4)

(10) If the total score in the upper section is greater than or equal to 63 for a player, then add 35 points to the total score

(11) Print the scores for both players and print the winner

(12) Repeat step (1)

Reference no: EM13684908

Questions Cloud

Obtain the potential energy stored in the cloud : In a thundercloud there may be an electric charge of +40 C near the top of the cloud and -40 C near the bottom of the cloud. Obtain the potential energy stored in the cloud
Determine the value of this resistor : A galvanometer has an internal resistance of 31 Ω and deflects full scale for a 45-mA current. Determine the value of this resistor which makes a voltmeter give a full scale deflection of 300V
Find what the distance between the lense : The eyepiece of a compound microscope has a focal length of 2.70 centimeter, and the objective lens has f = 0.740 centimeter. Find the distance between the lenses when the microscope is adjusted for a relaxed eye
Find at what temperature aluminum will have : Find at what temperature aluminum will have the same resistivity as tungsten does at 24oC
Develop and implement an interactive two-player yahtzee game : Eliminate redundancy within a program by applying loops and functions - Create structure charts for a given problem and determine an appropriate functional decomposition or top-down design from a structure chart
Estimate what the total angular momentum of the system : A horizontal circular platform rotates counterclockwise about its axis at the rate of 0.887 rad/s. You, with a mass of 70.5 kilogram, Estimate the total angular momentum of the system
Find what is the distance of the image formed : A concave mirror has a radius of curvature of 55 centimeter. If an object is 35 centimeter from the mirror, find what is the distance of the image formed
Evaluate what is the focal length of the mirror : A concave spherical mirror has a radius of curvature of 1.3 meter. Evaluate what is the focal length of the mirror
Determine what fraction of the sample is left : A radioactive sample has a half-life of 2.5 minute. Determine what fraction of the sample is left after 40 minute

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Objective1 to give students practice in calling and writing

objective1. to give students practice in calling and writing their own functions.2. to give students practice in

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

  Write a computer program to prepare a linear support vector

write a computer program to prepare a linear support vector machine svm. prepare a report and deliver the report

  Your program should include two functions

Your program should include two functions. Function celsius_at_depth should compute and return the Celsius temperature at a depth given in kilometers. Function fahrenheit should convert a Celsius temperature to Fahrenheit.

  Computes the area of a rectangle

Create an object oriented application with C# that computes the area of a rectangle, and the area and the volume of a cuboid.

  Design an algorithm to find the selling price

To make a profit, the prices of the items sold in a furniture store are marked up by 60%. Design an algorithm to find the selling price of an item sold at the furniture store. What information do you need to find the selling price?

  Value referenced by the pointer.

Add 10 to the value referenced by pointer switch.Add 4 to the address stored in pointer switch.Subtract 5 from the value referenced by the pointer.

  Write a program that asks user to enter

Write a program that asks user to enter the size of the matrix (rows and column) then, it asks the user to enter the elements of two matrices and finally it adds two matrix and displays the result in C language.

  Program to compute diameter in centimeters of a steel rod

Write a program to compute the diameter in centimeters of a steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Write a c program that recursively determines

Write a C program that recursively determines if a string is a palindrome. Before your program makes the palindrome determination, you must remove all punctuation characters from the string.

  Design a phonecall class that holds a phone number

Design a PhoneCall class that holds a phone number to which a call is placed, the length of the call in minutes, and the rate charged per minute. Overload extraction and insertion operators for the class.

  A robot can take steps of 1 meter

A robot can take steps of 1 meter, 2 meters, or 3 meters. Write a recursive function to calculate the number of ways the robot can walk n meters. (n is an integer obtained from user.) As example:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd