Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write your game() function and 3+ functions that simulate the game of Jeopardy Dice according to the following game mechanics and specifications. Game Mechanics There

write your game() function and 3+ functions that simulate the game of Jeopardy Dice according to the following game mechanics and specifications. 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 any 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 turnTotal over a series of dice rolls. If they roll a 2 or 5 , their turn ends and the turnTotal becomes 0. If they roll a 4, their turn ends and turnTotal becomes 15 (irrespective what they collected up to that roll) If they roll a 1, 3, or 6 , the value on the dice accumulates to turnTotal The value on the dice is selected randomly during every roll. At the end of the turn, turnTotal is accumulated to playerTotal(either user or computer based on the turn). During a turn, before each roll, if the player is the user, they are given two options: Continue rolling Hold; if the user chooses to Hold the users turn ends and the turn is passed to the computer. If the player is the computer, they will always continue rolling until their turn total reaches the value 10 or higher. If the turnTotal for the computer is 10 or higher, the computers turn ends and the turn is passed to the user. Specifications: Your solution must have an algorithm in pseudocode explaining how you are approaching the problem, step by step. In the code runner we have main() function to test your game() function. game() function is the driver function of your program and we will be testing your game() function on Moodle (CodeRunner). The function does not take any input parameters. The function does not return any value. Your solution should have at least 3 functions apart from 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 are given the freedom to design the functions of your choice. There are no restrictions on how many functions you create. Creating functions that does nothing is not permitted. Each function should have a purpose and should be well documented. Out of the three functions (or more) you will create, One of the functions must have at least 1 input parameter One of the functions must return a value One of the functions should not return anything, but it should print/display something.

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago