Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. rock = 0
  2. paper = 1
  3. scissors = 2
  4.  
  5. A_WINS = 0
  6. B_WINS = 1
  7. DRAW = 2
  8.  
  9. outcomes[][] = { { DRAW, B_WINS, A_WINS },
  10. { A_WINS, DRAW, B_WINS},
  11. { A_WINS, B_WINS, DRAW}
  12.  
  13. compare(a, b) {
  14. return outcomes[a, b]
  15. }
  16.  
  17. choose() {
  18. return random(0, 3)
  19. }
  20.  
  21. userInput = getInput()
  22. computerInput = choose()
  23.  
  24. result = compare(userInput, computerInput)
  25.  
  26. output(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement