Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB 5. Chapter 5, Problem 18a (Rock-paper-scissors, Version One) // Filename: rps1.m NOTE: Only complete part a. (labeled Version One). Be sure to name the
MATLAB
5. Chapter 5, Problem 18a (Rock-paper-scissors, Version One) // Filename: rps1.m NOTE: Only complete part a. (labeled Version One). Be sure to name the program rpsl.m. For those unfamiliar with rock-paper-scissors, it is a game where two users (in this case one user is a computer) select either rock ('r'), paper ('p'), or scissors ('s'). If both users pick the same object, there is a tie. Otherwise, the winner is determined by the following rules: Rock beats scissors Paper beats rock Scissors beats paper 18. Rock-paper-scissors. Write a program, rps.m, which plays the game rock-paper-scissors with the user. The user enters an "r," "p," "s," or "q" to quit the game. The computer honestly (randomly) selects a choice, then tells the user who won, and prompts for another input. The computer keeps a running total of human wins and losses. Develop the program by writing some simpler versions first. a. Version One. Write a program, rps1.m that runs a single turn of the game. Generate the computer's choice using rand. Prompt the user for the choice "r," "p," or "s." Decide who won the turn (human or computer) and display the resultsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started