Zebra0.com

alice lifecycle

Rock, paper scissors is a well known game in the United States. Two players count 1, 2, 3, then each throw down one hand as a rock (closed fist), paper (all fingers out), or scissors (two fingers out).

The winner is as follows:

The game

Story: Odin and the Troll will play a game of rock paper scissors.

Pseudocode:

  1. Odin will count down 3, 2, 1.
  2. A random number from 0 to 2 (0,1,2) will be selected.
  3. If the number is 0, Odin will show rock.
  4. If the number is 1, Odin will show paper
  5. If the number is 2, Odin will show scissors.
  6. A random number from 0 to 2 (0,1,2) will be selected.
  7. If the number is 0, Troll will show rock.
  8. If the number is 1, Troll will show paper
  9. If the number is 2, Troll will show scissors.
  10. Decide the winner

You may find that there are some steps that you haven't figured out the details for yet. Such as how to show the winner and how to manipulate the hands to show rock, paper, and scissors. We will use step wise refinement to work out all of the details.

End of lesson, Next lesson: