Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.11 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4. class Main
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner scan = new Scanner(System.in);
  9.         String choice;
  10.         Random random = new Random();
  11.         String[] CompChoices = {"Rock", "Paper", "Scissors"};
  12.         String BotChoice = CompChoices[0]; // random.nextInt(2)
  13.  
  14.         // DEBUG:
  15.         System.out.println("DEBUG:\nRandom Number: " + random);
  16.         System.out.println("Rock, Paper, or Scissors");
  17.         choice = scan.nextLine();
  18.         System.out.println("Player Choice: " + choice);
  19.         System.out.println("Bot Choice: " + BotChoice);
  20.         WhoWon(choice, BotChoice);
  21.     }
  22.  
  23.     public static void WhoWon(String brad, String chad)
  24.     {
  25.         String player = brad;
  26.         String comp = chad;
  27.  
  28.         if ((chad.equalsIgnoreCase("Rock")) && (brad.equalsIgnoreCase("Rock")))
  29.         {
  30.             System.out.print(brad + " vs. " + chad + ". ");
  31.             System.out.println("You Tied");
  32.         }
  33.         if ((player.equalsIgnoreCase("Rock")) && (comp.equalsIgnoreCase("Paper")))
  34.         {
  35.             System.out.print(player + comp);
  36.             System.out.println("You Lose");
  37.         }
  38.         if ((player.equalsIgnoreCase("Rock")) && (comp.equalsIgnoreCase("Scissors")))
  39.         {
  40.             System.out.print(player + comp);
  41.             System.out.println("You Win");
  42.         }
  43.         if ((player.equalsIgnoreCase("Paper")) && (comp.equalsIgnoreCase("Rock")))        System.out.print("You Win");
  44.         if ((player.equalsIgnoreCase("Paper")) && (comp.equalsIgnoreCase("Paper")))       System.out.print("You Tied");
  45.         if ((player.equalsIgnoreCase("Paper")) && (comp.equalsIgnoreCase("Scissors")))    System.out.print("You Lose");
  46.         if ((player.equalsIgnoreCase("Scissors")) && (comp.equalsIgnoreCase("Rock")))     System.out.print("You Lose");
  47.         if ((player.equalsIgnoreCase("Scissors")) && (comp.equalsIgnoreCase("Paper")))    System.out.print("You Win");
  48.         if ((player.equalsIgnoreCase("Scissors")) && (comp.equalsIgnoreCase("Scissors"))) System.out.print("You Tied");
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement