title: memory game in javascript
body: <p>I am trying to make a memory game for my assignment in <code>Java</code>. I am stuck, so I need some help. So, I have made a menu where you choose your game difficulty (easy, medium, and hard). The various game modes give the player a different number of tries. I am stuck because I do not know how to get the tries' count to loop, making the count of tries go lower as the user guesses wrong. Moreover, I do not know how to flip the cards to show a certain letter (there is no code for this yet). Now, I have the game sets up as '[--]' to mimic the card being flipped over. If you can give me tips on the algorithm to make the count of tries, that would be great!</p>
  
  <pre><code>import java.util.Scanner;
  
  public class MemoryGame {
  
  public static void main(String[] args) {
      Scanner in = new Scanner (System.in);
      System.out.print("Welcome to Single Memory Game!\n");
      System.out.println("Please choose a diffictulty:");
      System.out.println("1 - Easy\n2 - Medium\n3 - Hard\n0 - Exit ");
  
      System.out.println("&gt;&gt; ");
      int Option = in.nextInt();
  
      if (Option == 1)
      {
          Scanner cardGuess = new Scanner (System.in);
          int Guesses = 20;
          System.out.println("You have "+ Guesses + " guesses remaining!");
          System.out.println("Please select card one: ");
          int cardOne = cardGuess.nextInt();
          System.out.println("Please select card two: ");
          int cardTwo = cardGuess.nextInt();
      }
      else if (Option == 2)
      {
          Scanner cardGuess = new Scanner (System.in);
          int Guesses = 10;
          System.out.println("You have " + Guesses + " guesses remaining!");
          System.out.println("Please select card one: ");
          int cardOne = cardGuess.nextInt();
          System.out.println("Please select card two: ");
          int cardTwo = cardGuess.nextInt();
      }
      else if (Option == 3)
      {
          Scanner cardGuess = new Scanner (System.in);
          int Guesses = 5;
          System.out.println("You have " + Guesses + " guesses remaining!");
          System.out.println("Please select card one: ");
          int cardOne = cardGuess.nextInt();
          System.out.println("Please select card two: ");
          int cardTwo = cardGuess.nextInt();
      }
      else 
      {
          System.out.println("Goodbye!");
      }
      int[] randomNumbers; 
         randomNumbers = new int[11]; //All 19 cards 
  
         for(int index = 0; index &lt; 11; index++) //Makes 9 indexes in the array
         {
             randomNumbers[index] = (int)(Math.random()*10); //Gives random values to index       
         }
         for(int index = 1; index &lt; 11; index++)
         {
             randomNumbers[index] += randomNumbers[index-1];
         }
  
         for(int index = 0; index &lt; 11; index++)
         {
             System.out.printf("[%3d] = [--]\n",index,randomNumbers[index]);
         }
  }
  }
  </code></pre>