From 68c3d48f175ea3f2a4385845ac61f4075b9cc43f Mon Sep 17 00:00:00 2001 From: Cyprien111 <105004796+Cyprien111@users.noreply.github.com> Date: Mon, 7 Apr 2025 09:09:39 +0200 Subject: [PATCH] optimisation de Play() --- src/GomokuGame.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/GomokuGame.java b/src/GomokuGame.java index 4b65a93..8b8498d 100644 --- a/src/GomokuGame.java +++ b/src/GomokuGame.java @@ -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) { + 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); }