Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MATLAB program that can automatically play Rock Paper Scissors Lizard Spock as a computer player and play the game against one human player.

Write a MATLAB program that can automatically play Rock Paper Scissors Lizard Spock as a computer player and play the game against one human player.

The program should:

Briefly explain to the player how to play your computer game.

Ask the human player to input the object (Rock, Paper, Scissors, Lizard, or Spock) the player wishes to make to the command window.

Print the object name (Rock, Paper, Scissors, Lizard, or Spock) made by the human player in the command window.

Generate a random integer between 1 and 5 to represent the object (Rock, Paper, Scissors, Lizard, or Spock) that the computer player makes.

Print the object name (Rock, Paper, Scissors, Lizard, or Spock) made by the computer player in the command window. The program should automatically determine the winning hand following the Rock Paper Scissors Lizard Spock game rules. If both players make the same object, it is a tie. Play again to determine the winning hand.

Scissors cuts paper.

Paper covers rock.

Rock crushes lizard.

Lizard poisons Spock.

Spock smashes scissors,

Scissors decapitates lizard.

Lizard eats paper.

Paper disproves Spock,

Spock vaporizes rock,

As it always has, rock crushes scissors To make the game fairer, the first player wins 2 hands is the winner.

The program should automatically repeat the Rock Paper Scissors Lizard Spock game until one player wins 2 hands.

The program must automatically stop after one player wins 2 hands.

The program should be able to determine who (the human player or the computer player) have won 2 hands and clearly print the winner in the command window.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

b. Where did they come from?

Answered: 1 week ago

Question

c. What were the reasons for their move? Did they come voluntarily?

Answered: 1 week ago

Question

5. How do economic situations affect intergroup relations?

Answered: 1 week ago