Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class RockPaperScissors
  4. {
  5. public static void main(String[] args)
  6. {
  7. String playerTwo = "";\to be honest I'm not sure what this is even for
  8.  
  9. Scanner keyboard = new Scanner(System.in);
  10. System.out.println("Lets play rock-paper-scissors! Please enter your move:");
  11.  
  12. int Choice = (int) (Math.round(Math.random()*3));
  13. if (Choice == 0)
  14. playerTwo = "ROCK";\rock = 0
  15. else if (Choice == 1)
  16. playerTwo = "PAPER";\paper = 1
  17. else if (Choice == 2)
  18. playerTwo = "SCISSORS";\scissors = 2
  19.  
  20. String playerOne = keyboard.nextLine();
  21. playerOne = playerOne.toUpperCase();
  22. if (playerOne.equals(playerTwo)){
  23. System.out.println("It's a tie, so nobody wins!");
  24. }
  25. if (playerOne.equals("ROCK")){}
  26. else if (playerTwo.equals("PAPER")){
  27. System.out.println("Your rock got covered by my paper. You lose!");
  28. }
  29. else if (playerTwo.equals("SCISSORS")){
  30. System.out.println("Your scissors got smashed by my rock. You win!");
  31. }
  32.  
  33. if (playerOne.equals("PAPER")){}
  34. else if (playerTwo.equals("ROCK")){
  35. System.out.println("Your paper covers my rock. You win!");
  36. }
  37. else if (playerTwo.equals("SCISSORS")){
  38. System.out.println("Your paper got cut by my scissors. You lose!");
  39. }
  40.  
  41. if (playerOne.equals("SCISSORS")){}
  42. else if (playerTwo.equals("ROCK")){
  43. System.out.println("Your scissors got smashed by my rock. You lose!");
  44. }
  45. else if (playerTwo.equals("PAPER")){
  46. System.out.println("Your scissors cut my paper. You win!");
  47. }
  48.  
  49. else
  50. System.out.println("Error. Please restart and enter either: "rock", "paper", or "scissors".");
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement