Advertisement
Guest User

i hate life

a guest
Apr 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Random;
  3. import java.util.Scanner;
  4. import java.util.concurrent.ThreadLocalRandom;
  5. public class HangMan {
  6.  
  7. public static void main(String[] args) {
  8. Random rand = new Random();
  9. Scanner scan = new Scanner (System.in);
  10. int options = 2, storeInBoard = 0, numOfGuess = 0;
  11. String name, words, userINput;
  12. int result;
  13. boolean Correct = false;
  14. while(options == 2){
  15. System.out.println("Welcome to Hangman!");
  16. System.out.println("Would you like to: ");
  17. System.out.println("1) Play Hangman.");
  18. System.out.println("2) Quit");
  19. options = scan.nextInt();
  20.  
  21. if(options == 1)
  22. {
  23. /*for(int i = 0; i < numOfGuess; i++)
  24. {
  25.  
  26. String[] apples = new String[6];
  27. apples[1] = ("a");
  28. String[] banana = new String[6];
  29. String[] orange = new String[6];
  30. String[] lemons = new String[6];
  31.  
  32. System.out.println("Pick one letter A-Z");
  33. Object userArray = scan.toString();
  34.  
  35. }*/
  36.  
  37. ArrayList<String> Words = new ArrayList<String>();
  38. Words.add("orange");
  39. Words.add("lemons");
  40. Words.add("limes");
  41. Words.add("pears");
  42.  
  43. /*System.out.println("Pick one letter A-Z");
  44. userINput = scan.next();*/
  45. String word = Words.get(ThreadLocalRandom.current().nextInt(0, Words.size()));
  46. String[] test = new String[6];
  47. test[0] = (word.substring(0,0));
  48. test[1] = (word.substring(1,1));
  49. test[2] = (word.substring(2,2));
  50. test[3] = (word.substring(3,3));
  51. test[4] = (word.substring(4,4));
  52. test[5] = (word.substring(5,5));
  53. /*result = word.compareTo(userINput);*/
  54. System.out.println(test[0]);
  55. while(numOfGuess >= 6){
  56.  
  57.  
  58.  
  59. }
  60.  
  61. }
  62.  
  63. if(options == 2)
  64. {
  65.  
  66. }
  67.  
  68.  
  69. }
  70.  
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement