Question
C++, I have most of the code done but need help finishing the problem. MY CODE THAT YOU CAN COPY AND PASTE int rollDice() {
C++, I have most of the code done but need help finishing the problem.
MY CODE THAT YOU CAN COPY AND PASTE
int rollDice() { return rand()%6+1; }
// displays the welcome message
void welcomeGame() { cout
// simulate human's turn
int humanTurn(int turn)
{ char rolltheDice='y'; char rollAgain='y'; int turnTotal=0; int dice_value; cout > rolltheDice; dice_value = rollDice(); cout
} cout> rollAgain; if(rollAgain == 'n' || rollAgain == 'N') { break; }
} turn = 0; return turnTotal;
}
// simulate computer's turn
int computerTurn(int turn) { int compturnTotal = 0; int dice_value; cout
} turn = 1; return compturnTotal; }
void game()
{ int turn = 1; int compTotal = 0; int humanTotal = 0; welcomeGame(); while(compTotal
} if(humanTotal >=100) { cout
else { cout
}
ADJUSTMENTS NEEDED TO FOLLOW THIS FORMAT
THANK YOU
(Problem 3, 60 points) This project's objective is to create a Jeopardy Dice game in which one player (the user) competes against the computer to reach 80 points. To start this project, download the template file jeopardyDice.cpp from Moodle 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 . le o At the beginning of the player's turn, turnTotal starts at 0 o If they roll a 2 or 5, their turn ends and the turnTotal is equal to 0 o If they roll a 4, their turn ends and turnTotal is equal to 15 (irrespective what they collected up to that roll) o If they roll a 1, 3, or 6, turnTotal increases by the amount on the die and the player rolls again o The value on the die is selected randomly during every roll At the end of the turn, a player's total score, playerTotal (either user or computer based on the turn), is increased by turnTotal. . During a player's turn, before each roll, they are given two options o Continue rolling Hold; if the user chooses to Hold the user's turn ends, turnTotal is added to playerTotal, and the turn is passed to the computer o . 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 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started