Question: For my programming assignment, I need to write a shell script / bash named matchstick which plays a matchstick-picking game. matchstick 20 Would start a

For my programming assignment, I need to write a shell script / bash named "matchstick" which plays a matchstick-picking game.

matchstick 20

Would start a game with 20 sticks. Players take turns picking 1, 2 or 3 sticks from a pile. Whoever picks the last stick wins.

If no number is given, then ask the user to enter one. The program makes the first pick, then asks the user how many sticks they want to pick. Once there are no sticks left, the program announces who won.

If there is an illegal move, then the program allows the user to typpe in a number 1-3 again, if the user dosen't then they loose.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!