With a partner, spend a few moments outlining all the steps and conditions that go into a single game of rock-paper-scissors.
Try to break it down into steps that you could code out.
Think of basic elements like loops, if-else
statements, arrays, alerts, etc.
Be prepared to share your outlines approach.
Initialize choices
array: r, p, s. representing rock, paper, or scissors.
Prompt user to enter “r,” “p,” or “s”.
Computer chooses a random value in a list of “r,” “p,” or “s.”
We determine if the user wins or not.
Initialize wins
, losses
, ties
variables to 0
If user picks rock and if computer picks scissors, then user wins.
If user picks rock and if computer picks paper, then user loses.
If user picks scissors and if computer picks rock, then user loses.
If user picks scissors and if computer picks paper, then user wins.
If user picks paper and if computer picks rock, then user wins.
If user picks paper and if computer picks scissors, then user loses.
If user picks the same as computer, then they tie.
We then add to their score.
If user wins, then we add one to their wins.
If user loses, then we add one to their losses.
If user ties, then we add one to their ties.
Prompt user to play again.