Files
Fondamentaux-TP1/TTT_java/AIPlayer.java
2025-10-14 17:21:26 +02:00

19 lines
435 B
Java

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());
}
}