Question
c# only, no tryParse Oh I know, lets play Rock, Paper, Scissors, Lizard, Spock. Its very simple. What better way to expand the classic Rock,
c# only, no tryParse
Oh I know, lets play Rock, Paper, Scissors, Lizard, Spock. Its very simple. What better way to expand the classic Rock, Paper, Scissors game than to add Lizard and Spock! Sheldon and Raj brought Sam Kasss game to life on The Big Bang Theory in The Lizard-Spock Expansion episode. Were going to code a Gameinator-style C# console application that well affectionately call the RPSLSinator! What a fitting project for our final Programming Assignment.
Assignment & Discussion
Your task in Programming Assignment 8 is to create an application based on Rock, Paper, Scissors, Lizard, Spock (RPSLS). As this is our last programming assignment, all the stops are pulled out. Use any of the programming tools and techniques weve collected throughout the term.
As we saw in TBBT RPSLS demonstration in class, the rules are simple:
- Scissors cuts Paper
- Paper covers Rock
- Rock smashes Lizard
- Lizard poisons Spock
- Spock smashes Scissors
- Scissors decapitates Lizard
- Lizard eats Paper
- Paper disproves Spock
- Spock vaporizes Rock
- And, as it always has, Rock smashes Scissors
There are a number of ways you may choose to solve RPSLS. I recommend you consider the following two approaches, although there are likely others.
- Sequential if along with && (Conditional AND) statements. This is likely the most straight forward approach.
- Sequential if along with switch statements. If youre looking for a bit more elegant solution, this might work well for you.
To play the game, have the application pseudo-randomly generate Sheldons choice and your (the Gamers) choice. No direct user (Gamer) input desired. Use the same code from Programming Assignment 7 to instantiate an object of the Random class and then generate the two numbers using the same Next() method call.
Implement your RPSLS as a best of five game. The first person (Sheldon or you) to reach three wins is victorious. I recommend a while loop implementation as we have to account for ties. Do you sense a sentinel value here? Note: youll need to generate new game choices for each round of play.
I recommend you consider an enumerated type (enum) to represent Rock, Paper, Scissors, Lizard and Spock. I believe you will find using enumerated types more intuitive than using numbers.
I recommend you pay close attention to sequence, selection and iteration to ensure your RPSLS game plays properly.
I strongly recommend you spend time pseudocoding your RPSLS to develop your algorithm and get a feel for how you want to solve this challenge. RPSLS is not an overly difficult task, but it is more complex than our previous assignments and significantly longer (in terms of lines of code).
no tryParse
Step 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