“Oh I know, let’s play Rock, Paper, Scissors, Lizard,
Spock. It’s very simple.” What better way to expand the classic
Rock, Paper, Scissors game than to add Lizard and Spock! Sheldon
and Raj brought Sam Kass’s game to life on The Big Bang
Theory in “The Lizard-Spock Expansion” episode.
Assignment & Discussion
Your task in Programming Assignment 8 is to create a
C# console app-version of Rock, Paper, Scissors, Lizard, Spock
(RPSLS). Use any of the programming tools and techniques you have
collected throughout the term, even the previously banned
arrays.
The RPSLS rules are very simple:
- Scissors cuts Paper
- Paper covers Rock
- Rock crushes 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 crushes
Scissors
There are a number of ways you may choose to solve
RPSLS, including:
- Sequential if/if-else along
with &&(Conditional AND) statements
- Sequential if along
with switch statements
- Two-dimensional array (Chapter 8)
Pseudo-randomly generate Sheldon’s
choice andthe
Gamer’s choice. No user (Gamer) manual input
desired/required. Instantiate an object of the Random class and
then generate Sheldon’s number and your (the Gamer’s) number using
calls to the Next() method.
Implement your RPSLS so that the first person (Sheldon
or Gamer) to reach three wins is victorious. Ties do not count for
either player. I recommend a while loop as we do
have to account for rounds that end in a tie. Note: generate new
game choices (numbers) for each round of play.
For each round of play, write out each player’s
choice, the applicable rule, who wins that round and the updated
score. See Example Output below.
*** Do not slow down or pause the game play
unnecessarily. ***
Recommendations
Consider an enumerated type (enum) to represent
Rock, Paper, Scissors, Lizard and Spock. I believe you will find
the enumeration constants more intuitive in your code than the
underlying numerical values.
Pay close attention to sequence, selection and
iteration to ensure your RPSLS game plays
properly.
Spend time pseudocoding how you want to solve this
challenge. RPSLS is more complex than our previous assignments and
may be significantly longer (in terms of lines of code). Take time
to develop your algorithm. Don’t just hack it ‘til
it works…
Work on your test strategy and test to ensure all areas of your
code behave properly

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
List<string> listOfGestures = new List<string> {
"rock", "paper", "scissors", "lizard", "spock" };
int win = 0;
int lose = 0;
int tie = 0;
var newGame = true;
while (newGame)
{
var playerGesture = "";
var validInput = false;
while (!validInput)
{
var playerChoice = -1;
Console.WriteLine("Please choose your Gesture ");
gameSetup(listOfGestures);
try
{
playerChoice = Convert.ToInt32 (Console.ReadLine());
}
catch (FormatException e)
{
validInput = false;
}
if (playerChoice > 0 && playerChoice <=
listOfGestures.Count)
{
playerGesture = listOfGestures[playerChoice - 1];
validInput = true;
}
else
{
validInput = false;
}
}
var computerPlay = ComputerGesture(listOfGestures);
Console.WriteLine ("Computer: " + computerPlay);
Console.WriteLine ("your Gesture: " + playerGesture);
if (playerGesture == computerPlay)
{
tie++;
Console.WriteLine ("you have tied with the computer");
Console.WriteLine ("Computer: " + computerPlay);
Console.WriteLine ("your Gesture: " + playerGesture);
}
else
{
if (playerGesture == "rock")
{
if (computerPlay == "lizard" || computerPlay == "scissors")
{
Console.WriteLine ("You Win, " + playerGesture + " Crushes " +
computerPlay);
win++;
}
else if (computerPlay == "paper")
{
Console.WriteLine ("You Lose, Paper Covers Rock");
lose++;
}
else if (computerPlay == "spock")
{
Console.WriteLine ("You Lose, Spock Vaporizes Rock");
lose++;
}
}
else if (playerGesture == "paper")
{
if (computerPlay == "spock")
{
Console.WriteLine ("You Win, Paper Disproves Spock");
win++;
}
else if (computerPlay == "rock")
{
Console.WriteLine ("You Win, Paper Covers Rock");
win++;
}
else if (computerPlay == "lizard")
{
Console.WriteLine ("You Lose, Lizard Eats Paper");
lose++;
}
else if (computerPlay == "scissors")
{
Console.WriteLine ("You Lose, Scissors Cut Paper");
lose++;
}
}
else if (playerGesture == "scissors")
{
if (computerPlay == "paper")
{
Console.WriteLine ("You Win, Scissors Cut Paper");
win++;
}
else if (computerPlay == "lizard")
{
Console.WriteLine ("You Win, Scissors Decapitate Lizard");
win++;
}
else if (computerPlay == "rock")
{
Console.WriteLine ("You Lose, Rock Crushes Scissors");
lose++;
}
else if (computerPlay == "spock")
{
Console.WriteLine ("You Lose, Spock Smashes Scissors");
lose++;
}
}
else if ( playerGesture == "lizard")
{
if (computerPlay == "paper")
{
Console.WriteLine ("You Win, Lizard Eats Paper");
win++;
}
else if (computerPlay == "spock")
{
Console.WriteLine ("You Win, Lizard Poisons Spock");
win++;
}
else if (computerPlay == "scissors")
{
Console.WriteLine ("You Lose, Scissors Decapitates Lizard");
lose++;
}
else if (computerPlay == "rock")
{
Console.WriteLine ("You Lose, Rock Crushes Lizard");
lose++;
}
}
else if (playerGesture == "spock")
{
if (computerPlay == "rock")
{
Console.WriteLine("You Win, Spock Vaporizes Rock");
win++;
}
else if (computerPlay == "scissors")
{
Console.WriteLine ("You Win, Spock Smashes Scissors");
win++;
}
else if (computerPlay == "paper")
{
Console.WriteLine ("You Lose, Paper Disproves Spock");
lose++;
}
else if (computerPlay == "lizard")
{
Console.WriteLine("You Lose, Lizard Poisons Spock");
lose++;
}
}
}
Console.WriteLine ("Your Score is (W:L:T:) : {0}:{1}:{2}", win,
lose, tie);
Console.WriteLine ("Again? Type 'n' to leave game.");
if (Convert.ToString (Console.ReadLine ().ToLower ()) == "n")
{
Console.WriteLine ("would you like to reset your Score? y or
n");
if (Convert.ToString (Console.ReadLine ().ToLower ()) == "y")
{
win = 0;
lose = 0;
tie = 0;
}
Console.WriteLine ("would you like to play another game?");
Console.WriteLine ("if you type 'n' the game will end.");
if (Convert.ToString(Console.ReadLine().ToLower()) == "n")
{
newGame = false;
}
}
}
Console.WriteLine("Goodbye");
Console.ReadLine ();
} //end of main function
//gamesetup method
public static void gameSetup(List<string> List)
{
for (int i = 0; i < List.Count; i++)
{
Console.WriteLine((i + 1) + ": " + List[i]);
}
}
//ComputerGesture method
public static string ComputerGesture(List<string>
options)
{
Random rand = new Random();
return options[rand.Next(0, options.Count)];
}
}
}
“Oh I know, let’s play Rock, Paper, Scissors, Lizard, Spock. It’s very simple.” What better way...
java pls
Rock Paper Scissors Lizard Spock Rock Paper Scissors Lizard Spock is a variation of the common game Rock Paper Scissors that is often used to pass time (or sometimes to make decisions.) The rules of the game are outlined below: • • Scissors cuts Paper Paper covers Rock Rock crushes Lizard Lizard poisons Spock Spock smashes Scissors Scissors decapitates Lizard Lizard eats Paper Paper disproves Spock Spock vaporizes Rock Rock crushes Scissors Write a program that simulates the...
Its Simple spock smashes scissors scissors cuts paper scissors decapitates lizard paper disproves spock spock vaporiz0S rock rock crushes scissors lizard poisons spock paper covers rock lizard eats paper rock crushes lizard
Rock, Paper, Scissors - Write a MATLAB script file to play Rock, Paper, Scissors with the computer. x=rand; if x< 1/3 then it is Rock, if l/3<= x < 2/3 it is Paper else it is Scissors end if This is how the game should look like on the screen: Enter "r" for Rock, "p" for Paper, or "s" for Scissors", or enter "q" to Quit the game r leftarrow say, this is what you entered Computer choice: Scissors RESULT:...
5.12 A5 Program Do you want to play. a. game? The Big Bang Theory fans may recognize Rock Paper Scissors Lizard Spock as a game of chance that expands on the standard Rock Paper Scissors game. It introduces two new hand signs and several more rules. The rules: • Scissors cuts Paper • Paper covers Rock • Rock crushes Lizard • Lizard poisons Spock • Spock smashes Scissors • Scissors decapitates Lizard • Lizard eats Paper • Paper disproves Spock...
C++ Part 2: Rock Paper Scissors Game Write a program that lets the user play this game against the computer. The program should work as follows: When the program begins, a random number between 1 and 3 is generated. If the number is 1, the computer has chosen rock. If the number is 2, the computer has chosen paper. If the number is 3, the computer has chosen scissors. Don't display the computer's choice yet. Use a menu to display...
Using python 3.7.3 Challenge: Rock, Paper, Scissors GamePDF Description: Create a menu-driven rock, paper, scissors game in Python 3 that a user plays against the computer with the ability to save and load a game and its associated play statistics. Purpose: The purpose of this challenge is to assess the developer’s ability to create an interactive application with data persistence in Python 3. Requirements: Create a Rock, Paper, Scissors game in Python named rps.py according to the requirements specified in...
JAVA Beginnings of a paper-rock-scissors game. Paper-rock-scissors is a game often used to make decisions. There are two players. Each player secretly chooses either, paper, rock or scissors. At the count of three, each player reveals what they have chosen. The winner of the game is determined this way: paper beats rock (because paper covers rock) rock beats scissors (because rock crushes scissors) scissors beat paper (because scissors cut paper) If the two players choose the same item, it is...
In this problem, you’ll play a simple rock, paper, scissors game. First, you’ll ask the user to pick rock, paper, or scissors. Then, you’ll have the computer randomly choose one of the options. After that, print out the winner! You should keep playing the game until the user hits enter. Note: You’ll need to implement a method called String getWinner(String user, String computer). Luckily, you just wrote that in an earlier program! Here is a sample run of the program....
IN JAVA. Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet....
(c++ only)Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: When the program begins, the user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard using a menu in a function, userChoice, that returns a character. Next, there should be a function, computerChoice, that generates the computer’s play. A random number in the range of 1 through 3 is generated. If the...