title: Rock, paper, scissors simple game in java
body: <p>Hi I am making a simple rock, paper, scissors game and was having some trouble getting my compare method to get executed. The game prompts the user for input, and then using the computersTurn method to allow the computer to randomly select rock paper or scissors. When I try and pass both these values into my compare method, it doesn't seem to work. Any suggestions would be awesome!</p>
  
  <pre><code>import java.util.Scanner;
  
  
  
  public class sillyGame {
  
  public static void compare (String choice1, String choice2)
  
  {
  
      if (choice1.equals(choice2))
  
      {
  
      System.out.println("The result is a tie!");   
  
      }
  
  
  
      if (choice1.contains("rock"))
  
      {
          if (choice2.contains("scissors"))
          {
              System.out.println("rock wins");
          }
  
          if (choice2.contains("paper"))
          {
              System.out.println("paper wins");
          }
      }   
  
  
  
          if (choice1.contains("scissors"))
      {
          if (choice2.contains("rock"))
          {
              System.out.println("rock wins");
          }
  
          if (choice2.contains("paper"))
          {
              System.out.println("scissors wins");
          }
  
      }
  
  
  
      if (choice1.contains("paper"))
  
      {
          if (choice2.contains("rock"))
          {
              System.out.println("paper wins");
          }
  
          if (choice2.contains("scissors"))
          {
              System.out.println("scissors wins");
          }
  
      }
  
  
  
  
  }
  
  public static String computersTurn(String compFinalChoice, double randomNum){
  
  randomNum = Math.random();
  
  
      if (randomNum &lt; 0.34) 
      {
          compFinalChoice = "rock";
  
      } 
  
      else if(randomNum &lt;= 0.67) 
      {
          compFinalChoice = "paper";
  
      } 
  
      else 
      {
          compFinalChoice = "scissors";
  
      }
  
         System.out.println("The computer chooses " + compFinalChoice);
        return compFinalChoice;
  }
  
  
  
  public static void main(String[] args) {
  
      Scanner scan = new Scanner(System.in);
      System.out.println("Do you choose rock, paper or scissors?");
      String userChoice = scan.nextLine();
      String computerDec = " ";
      double rand = 0.0;
      computersTurn(computerDec, rand);
      compare(userChoice, computerDec); 
  }
  </code></pre>