Overview
Task: Write a bash script (rps.sh) that allows you to play "Rock, Paper, Scissors" against the computer.
Purpose: Demonstrate the skill to write a bash shell script.
Instructions
Write a bash script (rps.sh) that allows you to play "Rock, Paper, Scissors" against the computer.
The script should run as follows:
Requirements
Your bash script should present the following set of features (which are also in the attached ru
ic):
1. The game allows you to play Rock, Paper, Scissors against the computer.
2. The game is menu-driven.
3. The game runs continuously.
4. The game terminates when option 4 is selected.
5. The game plays according to the standard rule.
6. The game displays the same or similar messages as shown in the example output (shown above).
Your bash script must include the following constructs and statements:
1. if
2. while
3.
eak
4. echo
To allow the computer to play the game, use the following command:
computer=$(( ( RANDOM % XXXXXXXXXX ))
if (( "$computer" == 1 ))
then
echo "Computer chose 1. Rock"
elif
....
....
Submission Details
As you complete this assignment, look at the ru
ic below. Realize that this is an "all-or-nothing" assignment when it comes to grading criteria. Either your script can do the required actions or it cannot.
1. Upload your bash script (rps.sh) in Canvas.
2. Record your “Rock, Paper, Scissors” gameplay using the following command and upload the generated files (BashProj.log and BashProj.timing). Make sure that your recorded gameplay includes all four choices you can make (1. Rock, 2. Paper, 3. Scissors, 4. Done). Demonstrate that your bash script will co
ectly produce three outcomes that are possible (You won, You lost, You tied). Your demonstration of co
ect outcome need not be exhaustive. It can look like the one listed above. Just one instance of win, one instance of loss, and one instance of tie will do.
[me@linuxbox ~]$ script -a BashProj.log --timing=BashProj.timing
[me@linuxbox ~]$ . .
ps.sh
after the game play
[me@linuxbox ~]$ exit
[me@linuxbox ~]$ ls
BashProj.log BashProj.timing