What is a selection or conditional statement of gime yahtzee

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

Programming Assignment 5: The Game of Yahtzee

I. Learner 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

II. 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

III. Overview & Requirements:

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.

The Rules of Yahtzee:

The scorecard used for Yahtzee is composed of two sections. A upper section and a lower section. A total of thirteen boxes or thirteen scoring combinations are divided amongst the sections. The upper section consists of boxes that are scored by summing the value of the dice matching the faces of the box. If a player rolls four 3's, then the score placed in the 3's box is the sum of the dice which is 12. Once a player has chosen to score a box, it may not be changed and the combination is no longer in play for future rounds. If the sum of the scores in the upper section is greater than or equal to 63, then 35 more points are added to the players overall score as a bonus. The lower section contains a number of poker like combinations. See the table provided below:

Name

Combination

Score

Three-of-a- kind

Three dice with the same face

Sum of all face values on the 5 dice

Four-of-a- kind

Four dice with the same face

Sum of all face values on the 5 dice

Full house

One pair and a three-of-a-kind

25

Small straight

A sequence of four dice

30

Large straight

A sequence of five dice

40

Yahtzee (think five- of-a-kind)

Five dice with the same face

50

Chance

May be used for any sequence of dice; this is the catch all combination

Sum of all face values on the 5 dice

What is required for this assignment?

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

(Note: The selection of the combination must be verified. If the user selects full house, but does not have one, then your must assign 0 points for the combination);

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 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)

IV. Expected Results:

I recommend that you check out this website https://www.yahtzeeonline.org/ to grasp the game play for Yahtzee. Of course the game you build is text based.

V. Submitting Assignments:

1. Using the OSBLE+ MS VS plugin, please submit your solution. Please visit https://osble.codeplex.com/wikipage?title=Submitting%20an%20Assignment&referringTitle=VS%20Plugin for more information about submitting using OSBLE+.

2. Your project must contain one header file (a .h file), two C source files (which must be .c files), and project workspace.

3. Your project must build properly. The most points an assignment can receive if it does not build properly is 65 out of 100.

Reference no: EM131251107

Questions Cloud

Development of money and banking systems : Development of money and banking systems Political organization and parties?Taxation?Laws, regulations, justice and court systems Militaries. Describe the impacts of the technology on your home region
Discuss the effects of your own enculturation or group : Discuss the effects of your own enculturation or group identification that may have influenced your biases. Discuss whether or not your thinking about the topic has changed after playing the "Believing Game," even if your position on the issue has ..
Own idea for an innovation along with a model : During Phase 1, each individual will submit their own idea for an innovation along with a model they find useful for evaluating its merits. Each team member is responsible for completing research on various models.
Determine ending inventory and cost of goods sold : DETERMINE ENDING INVENTORY AND COST OF GOODS SOLD USING THE RETAIL METHOD.
What is a selection or conditional statement of gime yahtzee : What is a selection or conditional statement? Analyze a basic set of requirements and apply top-down design principles for a problem. What are while (), do-while (), and for () loops?
Do any items in your vertical analysis stand out : Do any items in your vertical analysis stand out? Why or why not? - What does your vertical analysis suggest for managing the company's financial health?
What problems could arise when using open systems theory : There have been suggestions made by people in the field that Open Systems Theory creates problems. Discuss what problems could arise when using Open Systems Theory. Given these problems, is it worth using Open Systems Theory in an organization?
What are the basic concerns with software testing : 1. What are the basic concerns with software testing? 2. Why is a specification needed in order to do testing? 3. Why is path testing usually impractical?
Calculate the ratios for the company : Calculate the ratios for the company selected in Milestone One and show your calculations for each indicator in an appendix.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that reads an array with wind-tunnel test

write a program that reads an array with wind-tunnel test data then allowss the user to enter a flight-path angle. If the angle is within the bounds of the data set, the program should then use linear inteerpolation to compute the corresponding coeff..

  Write a program to create circular link list

Write a program to create circular link list (CLL1) by inserting following elements: 10, 20, 30, 40, 50, -60, -70, 60, 50, 40, 30, 20, and -10. Display the contents of CLL1. Later create a function to delete an element say 40 from CLL1. While dele..

  In this assignment you have to implement and test a public

in this assignment you have to implement and test a public transport fare ticketing system. you will need to

  Function that returns the maximum value of the array

Arrays are collections of elements of the same type. The elements of the array can be accessed using their position (index) in the array.

  Draw the heap

Eric Rowe Starting with an empty minheap, draw the heap after each the completion of the following operations  and repeat for a maxheap (replace removeMin() with removeMax()). Upload your drawings here. Hand drawn is fine:

  Program that generates 50 random numbers of type

Write a program that generates 50 random numbers of type integer ranges from 1 to 1000 and load all the numbers into a C++ vector. The program should then display the largest, the smallest, the sum, and the average values stored in the vector.

  Write a program that mimics a calculator

Write a program that mimics a calculator. You should define the following functions: showMenu: it shows a menu of options to the user. Below is an example that shows the outputs of this function on the monitor.

  Sum of all the numbers

Write a program that repeatedly asks a user to enter a number. The program will sum up all the number that the user keyed in. Terminate the program when the user enters -9, and display the sum of all the numbers entered by the user (exclude -9).

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  Cashregister class that can be used with the retailitem clas

Write a CashRegister class that can be used with the RetailItem class that you wrote in Part 1. The CashRegister class should simulate the sale of a retail item. It should have a constructor that accepts a RetailItem object as an argument.

  Write a program to find the area of a circle

Write a program to find the area of a circle. The program should use two procedures. The first procedure will print out the program heading and ask the user to enter the radius.

  Write a program to read an array of sorted integers

Write a program in C++ to read an array of sorted integers. Search for a value using binary search method. If the element is found, print its location else print element not found

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