Week 3 Warm Up

Problem to be done as a demonstration in lab. Create a program that plays a coin flip guessing game with the user. Prompt the user for their input and then print if they guessed correctly or not. Keep playing the game until they select an option to quit. The solution is here.

Modify the example program to play rock-paper-sissors instead of flipping a coin. Also, keep track of the number of wins, losses, and ties.

Example:
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 1
The computer chose sissors
You win
You have 1 wins, 0 losses, and 0 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 1
The computer chose paper
You lose
You have 1 wins, 1 losses, and 0 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 1
The computer chose paper
You lose
You have 1 wins, 2 losses, and 0 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 1
The computer chose rock
It's a tie
You have 1 wins, 2 losses, and 1 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 1
The computer chose rock
It's a tie
You have 1 wins, 2 losses, and 2 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 1
The computer chose sissors
You win
You have 2 wins, 2 losses, and 2 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 2
The computer chose rock
You win
You have 3 wins, 2 losses, and 2 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): 3
The computer chose paper
You win
You have 4 wins, 2 losses, and 2 ties.
Play rock paper sissors (1 rock, 2 paper, 3 sissors, q quit): q

Additional problems:

Modify the rock-paper-sissors program to print goodbye when the user quits. Also quit if the user enters a capital Q.

Modify the program to check the user input to make sure it is a correct value. If the input is incorrect, keep asking the user for new input.

Modify the program to cheat at rock-paper-sissors. One fifth of the time (but not nessisarily every 5th turn), pick the winning move for the computer rather than a random number. This effect should only be evident over long runs.