mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 23:26:40 -08:00
Merge pull request #218 from olliehcrook/patch-4
Update TicTacToe2.java
This commit is contained in:
@@ -126,6 +126,29 @@ public class TicTacToe2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
} else if (gameBoard.checkDraw()) {
|
||||||
|
System.out.println("DRAW, PLAY AGAIN? (Y/N)");
|
||||||
|
gameBoard.clear();
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
char input;
|
||||||
|
input = in.next().charAt(0);
|
||||||
|
|
||||||
|
if (input == 'Y' || input == 'y') {
|
||||||
|
break;
|
||||||
|
} else if (input == 'N' || input == 'n') {
|
||||||
|
System.exit(0);
|
||||||
|
} else {
|
||||||
|
System.out.println("THATS NOT 'Y' OR 'N', TRY AGAIN");
|
||||||
|
in.nextLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("THATS NOT 'Y' OR 'N', TRY AGAIN");
|
||||||
|
in.nextLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user