Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class RockPaperScissors
- {
- public static void main(String[] args)
- {
- String playerTwo = "";\to be honest I'm not sure what this is even for
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Lets play rock-paper-scissors! Please enter your move:");
- int Choice = (int) (Math.round(Math.random()*3));
- if (Choice == 0)
- playerTwo = "ROCK";\rock = 0
- else if (Choice == 1)
- playerTwo = "PAPER";\paper = 1
- else if (Choice == 2)
- playerTwo = "SCISSORS";\scissors = 2
- String playerOne = keyboard.nextLine();
- playerOne = playerOne.toUpperCase();
- if (playerOne.equals(playerTwo)){
- System.out.println("It's a tie, so nobody wins!");
- }
- if (playerOne.equals("ROCK")){}
- else if (playerTwo.equals("PAPER")){
- System.out.println("Your rock got covered by my paper. You lose!");
- }
- else if (playerTwo.equals("SCISSORS")){
- System.out.println("Your scissors got smashed by my rock. You win!");
- }
- if (playerOne.equals("PAPER")){}
- else if (playerTwo.equals("ROCK")){
- System.out.println("Your paper covers my rock. You win!");
- }
- else if (playerTwo.equals("SCISSORS")){
- System.out.println("Your paper got cut by my scissors. You lose!");
- }
- if (playerOne.equals("SCISSORS")){}
- else if (playerTwo.equals("ROCK")){
- System.out.println("Your scissors got smashed by my rock. You lose!");
- }
- else if (playerTwo.equals("PAPER")){
- System.out.println("Your scissors cut my paper. You win!");
- }
- else
- System.out.println("Error. Please restart and enter either: "rock", "paper", or "scissors".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement