Rock Paper Scissors on the command line
rock smashes scissors, paper covers rock, scissors cuts paper
- Make a list of moves. i.e
["rock", "paper", "scissors"] - Use
random.choice()oncpu_moveso that the computer selects moves randomly.- import
randomto be able to userandom.choice()
- import
- print
user_moveandcpu_moveto update user - Set conditions for winning (rock smashes scissors, paper covers rock, scissors cuts paper)
- if player = cpu, it's a tie
- if player = rock and cpu = scissors, player wins else if cpu = paper, cpu wins
- if player = paper and cpu = rock, player wins else if cpu = scissors, cpu wins
- if player = scissors and cpu = paper, player wins else if cpu = rock, cpu wins
- Loop game, asking user if to continue after every round
- Assign each move a number so that you can reference.
- Convert return value to an int.
- use
enum.IntEnum
- use
- Break code down to functions
Had help from RealPython.com
