Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rock = 0
- paper = 1
- scissors = 2
- A_WINS = 0
- B_WINS = 1
- DRAW = 2
- outcomes[][] = { { DRAW, B_WINS, A_WINS },
- { A_WINS, DRAW, B_WINS},
- { A_WINS, B_WINS, DRAW}
- compare(a, b) {
- return outcomes[a, b]
- }
- choose() {
- return random(0, 3)
- }
- userInput = getInput()
- computerInput = choose()
- result = compare(userInput, computerInput)
- output(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement