Write a Ruby script that allows a human player to play the Rock-Paper-Scissors g
ID: 648901 • Letter: W
Question
Write a Ruby script that allows a human player to play the Rock-Paper-Scissors game against the computer.
To play the game, the human player chooses one of "rock," "paper," or "scissors." The computer also chooses, randomly with equal probability, one of these three plays.
These phases determine the winner for each combination: "rock crushes scissors", "scissors cuts paper," and "paper covers rock."
In this diagram, each arrow points from the winner to the user.
If both the human and the computer choose the same play, there is a tie.
Here is a sample script output. The human player's choices are shown in red.
You can base your script on this pseudocode:
Also show the answer!!
Write a Ruby script that allows a human player to play the Rock-Paper-Scissors game against the computer. To play the game, the human player chooses one of rock, paper, or scissors. The computer also chooses, randomly with equal probability, one of these three plays. These phases determine the winner for each combination: rock crushes scissors, scissors cuts paper, and paper covers rock. In this diagram, each arrow points from the winner to the user. If both the human and the computer choose the same play, there is a tie. Here is a sample script output. The human player's choices are shown in red.