Cracked Egg Game: There are a dozen eggs in a basket; some are hard boiled and some are raw. The object of this game is for the user to guess the number of hard-boiled eggs prior to playing the game. The computer then simulates cracking all 12 eggs, using a random number 0 or 1 to simulate raw or hard boiled. The number 0 should represent raw eggs and the number 1 should represent hard boiled. The computer must keep track of the number of hard-boiled eggs. At the conclusion of cracking all 12 eggs, the actual number of hard boiled is compared to the user’s guess, and whether the user won or lost is given as output. The goal of this milestone is to use Coral to program one of the loops you will need for your finalized program in Project Two. This will help you define the logic, flow, and sequence of the game. For this work, you will write code in Coral for your selected programming game by accessing the activity in the zyBook. Note that links for each are provided in the Scenario section. The work you complete will be based on your flowchart and pseudocode designs from Project One. Be sure to refer to any feedback you received for Project One prior to beginning coding in Coral. Specifically, you must address the following rubric criteria: Determine the variables and relevant data types of each variable. Consider the necessary variables required to implement the logic of your game, as well as the relevant data type (e.g., integer or float) of each variable. Consider your inputs and outputs for the program as you work. Initialize the variables using appropriate data values. Where necessary, assign an initial value to each variable. Note that variables that obtain an initial value from user input do not require initializing. For example, before you start simulating any of the games, there should be zero wins and losses. Set a branch that uses conditionals to define the logic of the game. This must meet the requirements of the program. This includes using the following: IF IF-ELSE IF-ELSE-IF Statements must also use the appropriate relational operators, which are as follows: == (equals) != (not equal) < (less than) > (greater than) <= (less than or equal) >= (greater than or equal) Create one loop to define the logic, flow, and sequence of the game. This must meet the requirements of the program. Reference the Brief Tutorial on Coral, linked in this week’s Resources section, for a reminder of how to create loops in Coral. Use a WHILE or FOR loop and the appropriate relational operators (==, !=, <, >, <=, and >=). Avoid infinite loops by ensuring the loop has an exit condition using the appropriate relational operator. Cracked Egg Game: Write code that will determine if one egg is hard boiled or raw. Spaceship Race: Write code that will apply a “boost” value to one spaceship in the race toward the distant star. Rock-Paper-Scissors: Write code that will play the game once. Apply necessary arithmetic operations. Note that mathematical operators include +, -, *, /, and % (modulo). This must meet the requirements of the program. For example, in each of the games, you will want to keep track of wins and losses. Cracked Egg Game: Keep track of whether the hard-boiled egg or raw egg was chosen. Spaceship Race: Keep track of the distance traveled in the first round. Rock-Paper-Scissors: Keep track of the player who won the first round in the Rock-Paper-Scissors game. Write code using best practices including appropriate syntax and commenting. This includes the following: Using descriptive names for your variables Using the correct formatting structure with appropriate indentations Using appropriate comments relating to your code
THIS MUST BE DONE IN CORAL:
- Cracked Egg Game: There are a dozen eggs in a basket; some are hard boiled and some are raw. The object of this game is for the user to guess the number of hard-boiled eggs prior to playing the game. The computer then simulates cracking all 12 eggs, using a random number 0 or 1 to simulate raw or hard boiled. The number 0 should represent raw eggs and the number 1 should represent hard boiled. The computer must keep track of the number of hard-boiled eggs. At the conclusion of cracking all 12 eggs, the actual number of hard boiled is compared to the user’s guess, and whether the user won or lost is given as output.
The goal of this milestone is to use Coral to program one of the loops you will need for your finalized program in Project Two. This will help you define the logic, flow, and sequence of the game.
For this work, you will write code in Coral for your selected
Specifically, you must address the following rubric criteria:
- Determine the variables and relevant data types of each variable. Consider the necessary variables required to implement the logic of your game, as well as the relevant data type (e.g., integer or float) of each variable. Consider your inputs and outputs for the program as you work.
- Initialize the variables using appropriate data values. Where necessary, assign an initial value to each variable. Note that variables that obtain an initial value from user input do not require initializing. For example, before you start simulating any of the games, there should be zero wins and losses.
- Set a branch that uses conditionals to define the logic of the game. This must meet the requirements of the program. This includes using the following:
- IF
- IF-ELSE
- IF-ELSE-IF
- == (equals)
- != (not equal)
- < (less than)
- > (greater than)
- <= (less than or equal)
- >= (greater than or equal)
- Create one loop to define the logic, flow, and sequence of the game. This must meet the requirements of the program. Reference the Brief Tutorial on Coral, linked in this week’s Resources section, for a reminder of how to create loops in Coral. Use a WHILE or FOR loop and the appropriate relational operators (==, !=, <, >, <=, and >=). Avoid infinite loops by ensuring the loop has an exit condition using the appropriate relational operator.
- Cracked Egg Game: Write code that will determine if one egg is hard boiled or raw.
- Spaceship Race: Write code that will apply a “boost” value to one spaceship in the race toward the distant star.
- Rock-Paper-Scissors: Write code that will play the game once.
- Apply necessary arithmetic operations. Note that mathematical operators include +, -, *, /, and % (modulo). This must meet the requirements of the program. For example, in each of the games, you will want to keep track of wins and losses.
- Cracked Egg Game: Keep track of whether the hard-boiled egg or raw egg was chosen.
- Spaceship Race: Keep track of the distance traveled in the first round.
- Rock-Paper-Scissors: Keep track of the player who won the first round in the Rock-Paper-Scissors game.
- Write code using best practices including appropriate syntax and commenting. This includes the following:
- Using descriptive names for your variables
- Using the correct formatting structure with appropriate indentations
- Using appropriate comments relating to your code
// Declare variables here
// Uncomment the line below when implementing your program
//SeedRandomNumbers(2)
// Type your code here
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
what is the psuedocode for the cracked egg game?