Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scripts Script 1 : Rock, Paper, Scissors Create a script that allows the script user to play Rock, Paper, Scissors against the CPU. The script

Scripts
Script 1: Rock, Paper, Scissors
Create a script that allows the script user to play Rock, Paper, Scissors against the CPU.
The script must meet the following requirements:
Use a menu to display the script user's choices:
Rock
Paper
Scissors
Quit
Use a select statement as the method to create the menu and take the script user's
choice.
Conditional statements to handle the possible outcomes of the game (i.e. tell the user
who wins in each scenario).
Use a case statement to handle processing of what happens once the script user's
selection has been made.
Helpful Hints
You can use the shuf command to simulate the script's turn at the game. Research the syntax of
the command and how you can use it for this script's purpose.
For example:
cpuSelection=$(shuf -n 1-e 123)
The command above will simply shuffle the items into a different order. The -n option tells the
command to output only the number provided with the option. In this case, a 1 indicates that
we only want the first shuffled item to be sent to output. This simulates a random choice.
You are free to use the command exactly like it is for your script, but you just need to find a way
in your script to convert the numbers to the necessary option (Rock, Paper, Scissors).
image text in transcribed

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

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions