optimisation de Play()
This commit is contained in:
@@ -63,22 +63,11 @@ public class GomokuGame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Place the token on the cell where the player play.
|
* 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) {
|
public void play(Player player) {
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
GomokuCell cellToPlay = player.chooseMove(board);
|
||||||
cellToPlay.setState(colorP1);
|
cellToPlay.setState(colorP1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user