2021-01-27 12:24:17 +01:00
|
|
|
package othello;
|
|
|
|
|
2021-02-24 11:52:16 +01:00
|
|
|
import othello.players.AlphaBetaPlayer;
|
2021-02-16 13:41:20 +01:00
|
|
|
import othello.players.Player;
|
2021-02-12 09:18:03 +01:00
|
|
|
|
2021-01-27 12:24:17 +01:00
|
|
|
public class Main {
|
|
|
|
|
2021-02-20 18:54:38 +01:00
|
|
|
|
2021-01-27 12:24:17 +01:00
|
|
|
public static void main(String[] args) {
|
2021-02-24 11:52:16 +01:00
|
|
|
Player p1 = new AlphaBetaPlayer(5);
|
|
|
|
Player p2 = new AlphaBetaPlayer(5);
|
2021-02-16 13:41:20 +01:00
|
|
|
Player[][] board = initialize(p1, p2);
|
2021-02-10 11:21:33 +01:00
|
|
|
State game = new State(board, p1, p2);
|
2021-02-12 09:38:18 +01:00
|
|
|
System.out.println("joueur 1: " + p1);
|
|
|
|
System.out.println("joueur 2: " + p2);
|
2021-02-12 09:18:03 +01:00
|
|
|
while(!game.isOver()) {
|
2021-02-16 13:41:20 +01:00
|
|
|
Player player = game.getCurrentPlayer();
|
2021-02-12 09:38:18 +01:00
|
|
|
System.out.println(game.toString());
|
2021-02-22 21:23:03 +01:00
|
|
|
game = game.play(player.play(game));
|
2021-02-12 09:18:03 +01:00
|
|
|
}
|
2021-02-20 18:54:38 +01:00
|
|
|
System.out.println(game.toString());
|
2021-02-24 11:52:16 +01:00
|
|
|
System.out.println(game.getN1()+" "+ game.getN2());
|
2021-02-20 18:54:38 +01:00
|
|
|
System.out.println(game.getWinner() + " a gagné la partie");
|
2021-02-24 11:52:16 +01:00
|
|
|
System.out.println("Score joueur 1 -> " + game.getN1());
|
|
|
|
System.out.println("Score joueur 2 -> "+ game.getN2());
|
2021-02-24 11:27:50 +01:00
|
|
|
|
2021-01-27 12:24:17 +01:00
|
|
|
}
|
|
|
|
|
2021-02-16 13:41:20 +01:00
|
|
|
public static Player[][] initialize(Player p1, Player p2){
|
|
|
|
Player[][] board = new Player[7][7];
|
2021-01-27 12:24:17 +01:00
|
|
|
board[0][0] = p2;
|
|
|
|
board[0][6] = p1;
|
|
|
|
board[6][0] = p1;
|
|
|
|
board[6][6] = p2;
|
|
|
|
return board;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|