Write a MARIE program to implement one round of rock paper scissors game. Your program should represent the three moves ‘rock’, ‘paper’ and ‘scissors’ with numbers 1, 2 and 3 respectively. When the program is run, there should be two input prompts, one after the other, to ask for player 1’s and player 2’s moves (a number 1, 2 or 3). Then the program would compare both numbers and apply the following rules to work out the winner.
- Paper beats rock, scissors beat paper and rock beats scissors.
- If both moves are same, round is drawn.
Depending on the results of comparison there will be one of the three outputs: ‘P1 Won’ or ‘P2 Won’ or ‘Draw’. Once a result is obtained, the program would take a third input from user to ask if they want to repeat with another round. User should enter a number 1 to indicate ‘yes’ and that should repeat the whole process. Any input other than 1 should be treated as ‘no’ and quit the program.
Use ‘decimal’ mode for inputs and ‘Unicode’ mode for outputs. To display text on output, you need to print it character by character using their ASCII codes. Insert a line break (ASCII code 10) before starting next round. Assume that the user will always provide valid numbers as input — do not worry about dealing with invalid input data. Also write comments within your program so that a reader can understand it easily.
Use the online MARE simulator at this link: https://marie.js.org/
For guidance on how to write MARIE programs, watch these two videos: MARIE Programming Part-I and MARIE Programming Part-II