The player starts out with a health of 0 (zero). Each turn of the game, the computer will roll two dice (where each dice has a random number between 1 and 6). If the dice roll is a doubles (i.e., the two die are 1,1 or 2,2 or 3,3 or 4,4 or 5,5 or 6,6) then the player’s health is increased by 4. If the dice roll is not a doubles, but the sum of the two dice is an even number, then the player’s health is increased by 1. If the dice roll is not a doubles, but the sum of the two dice is an odd number, then the player’s health is decreased by 2. If the player’s health reaches -10 (or anything lower), then the player loses the game. If the player’s health reaches 10 (or anything higher), then the player wins the game. If the player has not yet won and has not yet lost but has successfully completed 7 turns, then the player has the option to stop with an outcome of tie. If the player has not yet won or lost (and thus has not completed 7 turns), the player can decide to quit the game (without a win, loss, or tie). Your program should first explain the program to the user.
After each roll, the program should print out the current roll of the dice (for this turn), along with the current level of health (based on this current roll of the dice), and the number of turns that have been completed so far. If the player has won or lost, the program should print it out at this point and then end. If the player has not yet won or lost, the program should tell the user whether, if they quit right now, if they would end in a tie. (That is, the program should tell the user (if they have completed 7 or more turns) that they could stop now with a “tie”.) The program must then ask the user if they would like to keep going for one more turn. If the user enters “n”, then the program should print out a message saying that the user has a “tie” or that the user has decided to quit. If the user enters “y”, then the program should go on to the next turn. You can assume that the user enters correct input: either a “y” or an “n”.
See below for three sample runs of a program that implements this game. Be sure to match the prompts, the output, and the input of this program. Be sure to test your program to see that it will win properly, lose properly, tie properly, and quit (without a tie) properly.
Sample run: See image.
Sample run: See image.
Sample run: See image.