optimisation de Play()

This commit is contained in:
Cyprien111
2025-04-07 09:09:39 +02:00
parent d8b4e23507
commit 68c3d48f17

View File

@@ -63,22 +63,11 @@ public class GomokuGame {
/**
* Place the token on the cell where the player play.
* @param turn the turn of the player.
* @param Player get player to play the cell.
*/
public void play(int turn) {
GomokuCell cellToPlay = null;
switch (turn) {
case 1:
cellToPlay = player1.chooseMove(board);
break;
case 2:
cellToPlay = player2.chooseMove(board);
break;
default:
throw new IllegalArgumentException("Invalid turn: " + turn);
}
public void play(Player player) {
GomokuCell cellToPlay = player.chooseMove(board);
cellToPlay.setState(colorP1);
}