// }
}
} else if (mode==2) {
//create human and AI
PlayerHuman player1 = new PlayerHuman(0);
PlayerAI player2 = new PlayerAI(board, move, 1);
System.out.println("Player1: White");
System.out.println("Player2: Black");
int whosTurn = 0; //white starts
System.out.println();
System.out.println("Player1's turn");
// board.showGameStateWithNotation();
boolean cont = true;
String src, dest;
sc.nextLine(); //clear buffer
while (cont && !checkmate) {
boolean legalMove = false;
//repeat until move is legal
if (whosTurn==0) {
while (!legalMove) {
System.out.println("What piece you'd like to move? (notation)");
src = sc.nextLine();
System.out.println("Where you'd like to move that piece? (notation)");
dest = sc.nextLine();
if (whosTurn==player1.getSide()) {
legalMove = move.doMove(player1, src, dest);
}
if (!legalMove) {
System.out.println("Illegal move");
}
}
whosTurn = 1;
} else if (whosTurn==1) {
player2.doBestMove(player2);
whosTurn = 0;
}
// board.showGameStateWithNotation();
//inform that player turn changes
if (whosTurn==player1.getSide()) {
System.out.println("Player1's turn");
} else {
System.out.println("Player2's turn");
}
//check for checkmate
checkmate = game.checkCheckmate(board, move, player1, player2);
}
} else if (mode==3) {
//create two AIs
PlayerAI player1 = new PlayerAI(board, move, 0);
PlayerAI player2 = new PlayerAI(board, move, 1);
System.out.println("Player1: White");
System.out.println("Player2: Black");
//limit moves to 50
loop: for (int i=0; i<50; i++) {
player2.doBestMove(player1);
player2.doBestMove(player2);
System.out.println((i+1)+". round");
// board.showGameStateWithNotation();
//check for checkmate
if (game.checkCheckmate(board, move, player1, player2)) {
break loop;