Guest User

Memory Game - Made by Walker Christie

a guest
Nov 7th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.38 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class GameMain{
  3.  
  4.     /**
  5.      * @param args
  6.      */
  7.     public static void main(String[] args) {
  8.         // TODO Auto-generated method stub
  9.         /**
  10.          * Made by Walker Christie
  11.          */
  12.         Scanner input = new Scanner(System.in);
  13.         System.out.println("Welcome to the memory game.");
  14.         System.out.println("Please enter your name below.");
  15.         String playername = input.nextLine();
  16.         System.out.println("");
  17.         try {
  18.             Thread.sleep(1000);
  19.         } catch (InterruptedException x) {
  20.         }
  21.         // How to play (instructions)
  22.         System.out.println("-------------------------------------------------------------");
  23.         System.out.println("|How to Play|");
  24.         System.out.println("1) Words will be listed in a certain order");
  25.         System.out.println("2) Re-enter the words in the order that they were listed");
  26.         System.out.println("3) If a word was re-entered incorrectly, the game will reset");
  27.         System.out.println("4) Seperate words with commas 'first, second, third, etc'");
  28.         System.out.println("5) You will be given a total of 5 seconds to enter the word");
  29.         System.out.println("-------------------------------------------------------------");
  30.         System.out.println("Please enter 'begin' to start the game.");
  31.         String begin = input.nextLine();
  32.         if(begin.equals(begin)){
  33.             System.out.println("");
  34.             System.out.println("");
  35.             System.out.println("");
  36.             System.out.println("");
  37.             System.out.println("");
  38.             System.out.println("");
  39.             System.out.println("");
  40.             System.out.println("");
  41.             System.out.println("");
  42.             System.out.println("");
  43.             System.out.println("Initiating Game...");
  44.             //Level 1
  45.             try {
  46.                 Thread.sleep(1000);
  47.             } catch (InterruptedException x) {
  48.             }
  49.             // The first word in the game
  50.             String word1 = "dog";
  51.             // Will print the word into the console
  52.             System.out.print("your word is "+word1+"");
  53.             try {
  54.                 Thread.sleep(3000);
  55.             } catch (InterruptedException x) {
  56.             }
  57.             System.out.println("");
  58.             System.out.println("Now, re-enter 'dog' into to the console");
  59.             String test1 = input.nextLine();
  60.             System.out.println("");
  61.             /**
  62.              * Will test to see
  63.              * If word entered, matches the word generated
  64.              */
  65.             if(!test1.equals("dog")){
  66.                 System.out.println("You have lost, please restart");
  67.                 String lost1 = input.nextLine();
  68.             }
  69.             if(test1.equals(word1)){
  70.                 System.out.println("");
  71.                 System.out.println("");
  72.                 System.out.println("");
  73.                 System.out.println("");
  74.                 System.out.println("");
  75.                 System.out.println("");
  76.                 System.out.println("");
  77.                 System.out.println("---------------------------");
  78.                 System.out.println("That matched, good job");
  79.                 System.out.println("Onto, the next word");
  80.                 System.out.println("---------------------------");
  81.                 //Level 2
  82.                 try {
  83.                     Thread.sleep(1000);
  84.                 } catch (InterruptedException x) {
  85.                 }
  86.                 System.out.println("");
  87.                 System.out.println("");
  88.                 String word2 = "computer";
  89.                 System.out.println("Your next word is "+word2+"");
  90.                 System.out.println("Now, you must enter the two words given, in order.");
  91.                 System.out.println("You must enter 'dog, computer' into the console to move on");
  92.                 String test2 = input.nextLine();
  93.                 if (!test2.equals("dog, computer")) {
  94.                     System.out.println("You have lost, please restart");
  95.                     System.out.println("You did not conmplete the tutorial stage.");
  96.                     String lost2 = input.nextLine();
  97.  
  98.                 }
  99.                 if(test2.equals("dog, computer")){
  100.                     System.out.println("Good job, moving on.");
  101.                     System.out.println("");
  102.                     System.out.println("");
  103.                     System.out.println("");
  104.                     System.out.println("");
  105.                     System.out.println("");
  106.                     System.out.println("--------------------------------------------------------");
  107.                     System.out.println("The tutorial stage is now over, initiating full game...");
  108.                     try {
  109.                         Thread.sleep(1000);
  110.                     } catch (InterruptedException x) {
  111.                     }
  112.                     System.out.println("Full game loaded");
  113.                     System.out.println("--------------------------------------------------------");
  114.                     System.out.println("");
  115.                     //Level 3
  116.                     String word3 = "water";
  117.                     System.out.println("Your new word is "+word3+"");
  118.                     System.out.println("Please enter the words in order");
  119.                     String test3 = input.nextLine();
  120.  
  121.                     if(!test3.equals("dog, computer, water")){
  122.                         System.out.println("You have lost, please restart");
  123.                         System.out.println("You did not conmplete the tutorial stage.");
  124.                         String lost3 = input.nextLine();   
  125.                     }
  126.  
  127.                     if(test3.equals("dog, computer, water")){
  128.                         System.out.println("That is correct, moving on.");
  129.                         System.out.println("");
  130.                         System.out.println("");
  131.                         System.out.println("");
  132.                         System.out.println("");
  133.                         System.out.println("");
  134.                         System.out.println("");
  135.                         System.out.println("");
  136.                         System.out.println("");
  137.                         String word4 = "flour";
  138.                         //Level 4
  139.                         System.out.println("Your new word is "+word4+"");
  140.                         System.out.println("Please enter the words in order");
  141.                         String test4 = input.nextLine();
  142.  
  143.                         if(!test4.equals("dog, computer, water, flour")){
  144.                             System.out.println("You have lost, please restart");
  145.                             String lost4 = input.nextLine();
  146.                         }
  147.  
  148.                         if(test4.equals("dog, computer, water, flour")){
  149.                             System.out.println("That is correct, moving on.");
  150.                             System.out.println("");
  151.                             System.out.println("");
  152.                             System.out.println("");
  153.                             System.out.println("");
  154.                             System.out.println("");
  155.                             System.out.println("");
  156.                             System.out.println("");
  157.                             System.out.println("");
  158.                             System.out.println("");
  159.                             System.out.println("");
  160.                             System.out.println("");
  161.                             //Level 5
  162.                             String word5 = "table";
  163.                             System.out.println("Your new word is "+word5+"");
  164.                             System.out.println("Please enter the words in order");
  165.                             String test5 = input.nextLine();
  166.  
  167.                             if(!test5.equals("dog, computer, water, flour, table")){
  168.                                 System.out.println("You have lost, please restart");
  169.                                 System.out.println("You finished with 5 points");
  170.                                 System.out.println("You can do better!");
  171.                                 String lost5 = input.nextLine();
  172.                             }
  173.  
  174.                             if(test5.equals("dog, computer, water, flour, table")){
  175.                                 System.out.println("That is correct, moving on.");
  176.                                 System.out.println("");
  177.                                 System.out.println("");
  178.                                 System.out.println("");
  179.                                 System.out.println("");
  180.                                 System.out.println("");
  181.                                 System.out.println("");
  182.                                 System.out.println("");
  183.                                 System.out.println("");
  184.                                 System.out.println("");
  185.                                 System.out.println("");
  186.                                 System.out.println("");
  187.                                 //Level 6
  188.                                 String word6 = "card";
  189.                                 System.out.println("Your new word is "+word6+"");
  190.                                 System.out.println("Please enter the words in order");
  191.                                 String test6 = input.nextLine();
  192.  
  193.                                 if(!test6.equals("dog, computer, water, flour, table, card")){
  194.                                     System.out.println("You have lost, please restart");
  195.                                     System.out.println("You finished with 6 points");
  196.                                     System.out.println("Pretty good!");
  197.                                     String lost6 = input.nextLine();
  198.                                 }
  199.  
  200.                                 if(test6.equals("dog, computer, water, flour, table, card")){
  201.                                     System.out.println("That is correct, moving on.");
  202.                                     System.out.println("");
  203.                                     System.out.println("");
  204.                                     System.out.println("");
  205.                                     System.out.println("");
  206.                                     System.out.println("");
  207.                                     System.out.println("");
  208.                                     System.out.println("");
  209.                                     System.out.println("");
  210.                                     System.out.println("");
  211.                                     System.out.println("");
  212.                                     System.out.println("");
  213.                                     //Level 7
  214.                                     String word7 = "block";
  215.                                     System.out.println("Your new word is "+word7+"");
  216.                                     System.out.println("Please enter the words in order");
  217.                                     String test7 = input.nextLine();
  218.  
  219.                                     if(!test7.equals("dog, computer, water, flour, table, card, block")){
  220.                                         System.out.println("You have lost, please restart");
  221.                                         System.out.println("You finished with 7 points");
  222.                                         System.out.println("Pretty good!");
  223.                                         String lost7 = input.nextLine();
  224.                                     }
  225.  
  226.                                     if(test7.equals("dog, computer, water, flour, table, card, block")){
  227.                                         System.out.println("That is correct, moving on.");
  228.                                         System.out.println("");
  229.                                         System.out.println("");
  230.                                         System.out.println("");
  231.                                         System.out.println("");
  232.                                         System.out.println("");
  233.                                         System.out.println("");
  234.                                         System.out.println("");
  235.                                         System.out.println("");
  236.                                         System.out.println("");
  237.                                         System.out.println("");
  238.                                         System.out.println("");
  239.                                         //Level 8
  240.                                         String word8 = "air";
  241.                                         System.out.println("Your new word is "+word8+"");
  242.                                         System.out.println("Please enter the words in order");
  243.                                         String test8 = input.nextLine();
  244.  
  245.                                         if(!test8.equals("dog, computer, water, flour, table, card, block, air")){
  246.                                             System.out.println("You have lost, please restart");
  247.                                             System.out.println("You finished with 8 points");
  248.                                             System.out.println("Good memorization!");
  249.                                             String lost8 = input.nextLine();
  250.                                         }
  251.  
  252.                                         if(test8.equals("dog, computer, water, flour, table, card, block, air")){
  253.                                             System.out.println("That is correct, moving on.");
  254.                                             System.out.println("");
  255.                                             System.out.println("");
  256.                                             System.out.println("");
  257.                                             System.out.println("");
  258.                                             System.out.println("");
  259.                                             System.out.println("");
  260.                                             System.out.println("");
  261.                                             System.out.println("");
  262.                                             System.out.println("");
  263.                                             System.out.println("");
  264.                                             System.out.println("");
  265.                                             //Level 9
  266.                                             String word9 = "section";
  267.                                             System.out.println("Your new word is "+word9+"");
  268.                                             System.out.println("Please enter the words in order");
  269.                                             String test9 = input.nextLine();
  270.  
  271.                                             if(!test9.equals("dog, computer, water, flour, table, card, block, air, section")){
  272.                                                 System.out.println("You have lost, please restart");
  273.                                                 System.out.println("You finished with 9 points");
  274.                                                 System.out.println("Fantastic memorization!");
  275.                                                 String lost9 = input.nextLine();
  276.                                             }
  277.  
  278.                                             if(test9.equals("dog, computer, water, flour, table, card, block, air, section")){
  279.                                                 System.out.println("That is correct, moving on.");
  280.                                                 System.out.println("");
  281.                                                 System.out.println("");
  282.                                                 System.out.println("");
  283.                                                 System.out.println("");
  284.                                                 System.out.println("");
  285.                                                 System.out.println("");
  286.                                                 System.out.println("");
  287.                                                 System.out.println("");
  288.                                                 System.out.println("");
  289.                                                 System.out.println("");
  290.                                                 System.out.println("");
  291.                                                 //Level 10
  292.                                                 String word10 = "string";
  293.                                                 System.out.println("Your new word is "+word10+"");
  294.                                                 System.out.println("Please enter the words in order");
  295.                                                 String test10 = input.nextLine();
  296.  
  297.                                                 if(!test10.equals("dog, computer, water, flour, table, card, block, air, section, string")){
  298.                                                     System.out.println("You have lost, please restart");
  299.                                                     String lost10 = input.nextLine();
  300.                                                     System.out.println("You finished with 10 points");
  301.                                                     System.out.println("Fantastic work!  Very close!");
  302.                                                 }
  303.  
  304.                                                 if(test10.equals("dog, computer, water, flour, table, card, block, air, section, string")){
  305.                                                     System.out.println("That is correct!");
  306.                                                     System.out.println("");
  307.                                                     System.out.println("-------------------------------------------------");
  308.                                                     System.out.println("Congratulations "+playername+"...");
  309.                                                     try {
  310.                                                         Thread.sleep(1000);
  311.                                                     } catch (InterruptedException x) {
  312.                                                     }
  313.                                                     System.out.println("you have won the memory game!");
  314.                                                     System.out.println("You finished with a total of 15 points!");
  315.                                                     try {
  316.                                                         Thread.sleep(1000);
  317.                                                     } catch (InterruptedException x) {
  318.                                                     }
  319.                                                     System.out.println("Care to play again?");
  320.                                                     System.out.println("-------------------------------------------------");
  321.  
  322.  
  323.                                                 }
  324.                                             }
  325.                                         }
  326.                                     }
  327.                                 }
  328.                             }
  329.                         }
  330.                     }
  331.                 }
  332.             }
  333.         }
  334.     }
  335. }
Advertisement
Add Comment
Please, Sign In to add comment