AI and player play correctly
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class GomokuAI{
|
||||
@@ -17,20 +18,25 @@ public class GomokuAI{
|
||||
* @param Board The actual Gomoku board.
|
||||
* @return The coordinate of the move played.
|
||||
*/
|
||||
public Coordinate chooseMove(GomokuBoard board){
|
||||
|
||||
public GomokuCell chooseMove(GomokuBoard board){
|
||||
|
||||
List<GomokuCell> playableCell = board.getPlayableCells();
|
||||
GomokuCell playCell;
|
||||
int x=0,y=0;
|
||||
if(difficulty == 0)
|
||||
{
|
||||
int rand = random.nextInt(board.getPlayableCells().size());
|
||||
|
||||
}
|
||||
|
||||
switch (difficulty) {
|
||||
case 0:
|
||||
playCell = playableCell.get(random.nextInt(playableCell.size()));
|
||||
break;
|
||||
case 1:
|
||||
System.out.println("L'IA réflechit...");
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
System.out.println("L'IA à choisi : "+ x+", "+ y);
|
||||
|
||||
|
||||
return new Coordinate(x,y);
|
||||
return playCell;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user