Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. package hangman;
  2.  
  3. import java.io.IOException;
  4.  
  5. public class Main {
  6.  
  7. /**
  8. * @param args the command line arguments
  9. */
  10. public static void main(String[] args)
  11. throws IOException {
  12.  
  13. Word test = new Word();
  14. GGL test2= new GGL();
  15.  
  16.  
  17.  
  18.  
  19. int pogingen = 0;
  20.  
  21.  
  22. char choice;
  23.  
  24. for(;;){
  25. if(pogingen<9){
  26.  
  27.  
  28. do{
  29.  
  30.  
  31. test2.printGalg(pogingen);
  32. System.out.println("Voer een letter in A-Z:");
  33. System.out.println("Geraden letters:");
  34.  
  35.  
  36. do{
  37.  
  38. choice = (char) System.in.read();
  39.  
  40.  
  41.  
  42. }while(choice == '\n' | choice == '\r');
  43.  
  44.  
  45. test.processGuess(choice);
  46.  
  47. if(test.processGuess(choice)){
  48.  
  49. System.out.println("Letter " + choice + " zit in het woord.");
  50.  
  51.  
  52. }else{
  53. pogingen++;
  54. System.out.println("Dit is niet de juiste letter.");
  55. }
  56.  
  57. if(test.hasBeenGuessed()==false){
  58. System.out.println("U heeft nog niet het hele woord geraden.");
  59. }
  60.  
  61.  
  62.  
  63.  
  64. if(test.hasBeenGuessed()==true){
  65. System.out.println("U heeft het woord geraden.");
  66. return;
  67. }
  68. test.print();
  69.  
  70.  
  71.  
  72.  
  73. } while(choice>'a' & choice<'z' & choice!='q');
  74.  
  75. if(choice=='q') break;
  76.  
  77.  
  78.  
  79. }else{
  80. System.out.println("U heeft te veel pogingen gebruikt.");
  81. break;
  82. }
  83.  
  84.  
  85. }
  86.  
  87.  
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement