Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The objective is to create a Jeopardy Dice game in which one player (the user) competes against the computer to reach 80 points in c++.

The objective is to create a Jeopardy Dice game in which one player (the user) competes against the computer to reach 80 points in c++.

Game Mechanics

There are two players: the user and the computer, who alternate turns until one of them reaches 80 points or higher.

The user is always the first player and starts the game.

If either player reaches 80 points or more at the end of their turn, the game ends immediately and the other player does not get another turn.

During one turn the player (either the user or computer) accumulates a total number of points equal to turnTotal by repeatedly rolling a single fair 6-sided die. 1. At the beginning of the players turn, turnTotal starts at 0. 2. If they roll a 2 or 5, their turn ends and the turnTotal is equal to 0. 3. If they roll a 4, their turn ends and turnTotal is equal to 15 (irrespective what they collected up to that roll) 4. If they roll a 1, 3, or 6, turnTotal increases by the amount on the die and the player rolls again The value on the die is selected randomly during every roll

At the end of the turn, a players total score, playerTotal (either user or computer based on the turn), is increased by turnTotal.

During a players turn, before each roll, they are given two options: 1. Continue rolling 2. Hold; if the user chooses to Hold the users turn ends, turnTotal is added to playerTotal, and the turn is passed to the computer.

If the player is the computer, they will always continue rolling until their turnTotal reaches the value 10 or higher, at which point the computer player will end its turn and play passes to the user.

Your solution must have an algorithm in pseudocode explaining how you are approaching the problem, step by step.

Your main() function will have just one statement: a call to the function game(). Do not modify main().

game() function is the driver function of your program and we will be testing your game() function. 1. The function does not take any input parameters. 2. The function does not return any value.

Your solution should have at least 3 functions besides the game() and rollDie() functions. Since the functions you will create will be called from inside the game() function, their definition should be above the definition of game().

You must have a minimum of 3 functions of your choice.

Out of the three functions (or more) you will create 1. one of the functions must have at least 1 input parameter, 2. one of the functions must return a value, and 3. one of the functions should not return anything, but it should print/display something.

image text in transcribed

//Put your pseudocode for the entire game here (see template in jeopardyDice.cpp) #include #include #include #include #include using namespace std; *rollDie returns a random integer between 1 and 6, works as rolling a die. +return value, int number (1-6) int rollDie( return rand ( ) % 6 + 1; // your 3 + functions go in here game *driver function to play the game *the function does not return any value void game () // your solution goes here int main () // start the game! game ) return 0

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe how modern technology raises privacy concerns. AppendixLO1

Answered: 1 week ago