tp1 partie 1 et partie 2.1/2.2

This commit is contained in:
Kennro03
2025-10-14 17:21:26 +02:00
parent 30458c5907
commit b88b6e9b9d
26 changed files with 414 additions and 0 deletions

19
TTT_java/AIPlayer.java Normal file
View File

@@ -0,0 +1,19 @@
import java.util.Random;
public class AIPlayer extends Player {
private Random random;
public AIPlayer(char mark) {
super(mark);
random = new Random();
}
public void makeMove(Board board) {
int row, col;
do {
row = random.nextInt(3);
col = random.nextInt(3);
} while (!board.isCellEmpty(row, col));
board.placeMark(row, col, getMark());
}
}