2021-01-27 12:24:17 +01:00
|
|
|
package othello;
|
|
|
|
|
2021-01-27 18:27:28 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2021-02-12 09:18:03 +01:00
|
|
|
import othello.players.AbstractPlayer;
|
|
|
|
import othello.players.RandomPlayer;
|
|
|
|
|
2021-01-27 12:24:17 +01:00
|
|
|
public class Main {
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2021-02-12 09:18:03 +01:00
|
|
|
AbstractPlayer p1 = new RandomPlayer();
|
|
|
|
AbstractPlayer p2 = new RandomPlayer();
|
|
|
|
AbstractPlayer[][] board = initialize(p1, p2);
|
2021-02-10 11:21:33 +01:00
|
|
|
State game = new State(board, p1, p2);
|
2021-02-12 09:18:03 +01:00
|
|
|
// board[1][5]=game.getCurrentPlayer();
|
|
|
|
while(!game.isOver()) {
|
|
|
|
AbstractPlayer player = game.getCurrentPlayer();
|
2021-02-10 12:01:51 +01:00
|
|
|
ArrayList<Pair<Point, Point>> moves = game.getMove(player);
|
2021-02-12 09:18:03 +01:00
|
|
|
game.toString();
|
|
|
|
player.play(moves);
|
|
|
|
}
|
|
|
|
// ArrayList<Pair<Point, Point>> moves = game.getMove(game.getCurrentPlayer());
|
|
|
|
// System.out.println(moves.toString());
|
2021-01-27 12:24:17 +01:00
|
|
|
}
|
|
|
|
|
2021-02-12 09:18:03 +01:00
|
|
|
public static AbstractPlayer[][] initialize(AbstractPlayer p1, AbstractPlayer p2){
|
|
|
|
AbstractPlayer[][] board = new AbstractPlayer[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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|