-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.java
47 lines (35 loc) · 966 Bytes
/
main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*Takayuki Goto
*tictactoe with unbeatable AI
*
*The AI will have three types of moves
*Initial, Defensive and Offensive.
*
* 1. Initial is the first three turns of the game
*
* 2a.(POSSIBLE)4th turn phase. Important turn, have to watch out for
* possible set up.
*
* 2b. Defensive is done when the player is about to win with one
* more move left.
*
* 3. Offensive is done when there are no threats by the player
*
*Under a while loop, the game will continue as long as it hasn't
*reached 9 total turns or there is a clear winner.
*
*For the time being, player will always play first.
*
*/
public class main{
public static void main(String[] args){
tictactoe game = new tictactoe();
System.out.println("Time to play Tic Tac Toe!");
System.out.println("You will play the first move, so you are 'X'");
while(game.keepPlaying()){
game.printBoard();
game.makeMove();
if(game.count != game.TURNS)
game.AiMove();
}
}
}