-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.java
More file actions
40 lines (37 loc) · 1.08 KB
/
Game.java
File metadata and controls
40 lines (37 loc) · 1.08 KB
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
// Owen Gregson
// Artificial Intelligence
// TTT Checkpoint #3
// Dec 18, 2024
public class Game {
public Board board;
public Player nextPlayer;
public boolean isGameOver;
public Player winner;
public Line winningLine;
public boolean isPlayingAgainstAI;
public AIPlayer aiPlayerX;
public AIPlayer aiPlayerO;
public Player humanPlayer;
public Player aiSide;
public Game(Board board, Player nextPlayer, boolean isPlayingAgainstAI, boolean hasAIPlayer) {
this.board = board;
this.nextPlayer = nextPlayer;
this.isPlayingAgainstAI = isPlayingAgainstAI;
this.isGameOver = false;
this.winner = null;
this.winningLine = null;
this.aiPlayerX = null;
this.aiPlayerO = null;
this.humanPlayer = null;
this.aiSide = null;
}
public String stats() {
if (this.aiPlayerX != null) {
return this.aiPlayerX.stats();
} else if (this.aiPlayerO != null) {
return this.aiPlayerO.stats();
} else {
return "Pending...";
}
}
}