Rock, Paper, Scissors
Below is a program which determines the winner of a game of Rock, Paper, Scissors between two players.
The machine accepts an input tape containing two contiguous blocks of tallies separated by a blank tape cell, representing the moves of the two players. The first block of tallies (i.e., to the left) will represent the move of the first player, and the second block will represent the move of the second player.
Each contiguous block for a player's move can look like the following:
1
, if the move is Rock11
, if the move is Paper111
, if the move is Scissors
For example, the input tape 110111
would represent that the first player played Paper, and the second player played Scissors.
The output tape will be a contiguous block of tallies representing the result of the game. This output tape will take on one of the following forms:
1
, if the result was a tie11
, if the first player won111
, if the second player won
Last updated
Was this helpful?