diff --git a/src/othello/Main.java b/src/othello/Main.java index bd36cbc..70f9b8f 100644 --- a/src/othello/Main.java +++ b/src/othello/Main.java @@ -2,14 +2,13 @@ package othello; import othello.players.NegamaxPlayer; import othello.players.Player; -import othello.players.RandomPlayer; public class Main { public static void main(String[] args) { Player p1 = new NegamaxPlayer(1); - Player p2 = new RandomPlayer(-1); + Player p2 = new NegamaxPlayer(100); Player[][] board = initialize(p1, p2); State game = new State(board, p1, p2); System.out.println("joueur 1: " + p1); @@ -17,7 +16,7 @@ public class Main { while(!game.isOver()) { Player player = game.getCurrentPlayer(); System.out.println(game.toString()); - game = game.play(player.play(game,100)); + game = game.play(player.play(game)); } System.out.println(game.toString()); System.out.println(game.getWinner() + " a gagné la partie"); diff --git a/src/othello/players/NegamaxPlayer.java b/src/othello/players/NegamaxPlayer.java index 786c29f..57a084d 100644 --- a/src/othello/players/NegamaxPlayer.java +++ b/src/othello/players/NegamaxPlayer.java @@ -6,12 +6,12 @@ import othello.State; public class NegamaxPlayer extends Player { - public NegamaxPlayer(int id) { - super(id); + public NegamaxPlayer(int depth) { + super(depth); } @Override - public Pair play(State game,int depth) { + public Pair play(State game) { int bestValue = Integer.MIN_VALUE; Pair bestMove = null; for(Pair move : game.getMove(game.getCurrentPlayer())) { diff --git a/src/othello/players/Player.java b/src/othello/players/Player.java index 7363360..63dc123 100644 --- a/src/othello/players/Player.java +++ b/src/othello/players/Player.java @@ -6,12 +6,12 @@ import othello.State; public abstract class Player { - protected final int id; + protected final int depth; - public Player(int id) { - this.id = id; + public Player(int depth) { + this.depth = depth; } - public abstract Pair play(State board,int depth); + public abstract Pair play(State board); } diff --git a/src/othello/players/RandomPlayer.java b/src/othello/players/RandomPlayer.java index 78e9294..4560640 100644 --- a/src/othello/players/RandomPlayer.java +++ b/src/othello/players/RandomPlayer.java @@ -17,7 +17,7 @@ public class RandomPlayer extends Player { } @Override - public Pair play(State game, int depth) { + public Pair play(State game) { LinkedList> moves = game.getMove(this); return moves.get(random.nextInt(moves.size())); }