Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package hangman;
- import java.io.IOException;
- public class Main {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args)
- throws IOException {
- Word test = new Word();
- GGL test2= new GGL();
- int pogingen = 0;
- char choice;
- for(;;){
- if(pogingen<9){
- do{
- test2.printGalg(pogingen);
- System.out.println("Voer een letter in A-Z:");
- System.out.println("Geraden letters:");
- do{
- choice = (char) System.in.read();
- }while(choice == '\n' | choice == '\r');
- test.processGuess(choice);
- if(test.processGuess(choice)){
- System.out.println("Letter " + choice + " zit in het woord.");
- }else{
- pogingen++;
- System.out.println("Dit is niet de juiste letter.");
- }
- if(test.hasBeenGuessed()==false){
- System.out.println("U heeft nog niet het hele woord geraden.");
- }
- if(test.hasBeenGuessed()==true){
- System.out.println("U heeft het woord geraden.");
- return;
- }
- test.print();
- } while(choice>'a' & choice<'z' & choice!='q');
- if(choice=='q') break;
- }else{
- System.out.println("U heeft te veel pogingen gebruikt.");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement