Closed olufjen closed 3 years ago
This is caused by mixing who's turn it is to move
This is also the same bug. Move 4: white pawn takes Knight at c6. Bishop moves to e6. Move 5 is meaningless
After7 moves. Several pieces have more than one position.
After 5 moves: The Na6 move should have been Be6, followed by a white move.
This happens after the currDepthLimit of ChessAphaBetaSearch has a max value of 1.
The problems described above occur in the following setting: ** Analyzing state *** To move Piece ==================== Chessstate Piece positionc3 X, Y (2, 2) wN c3KNIGHTName N My features 47 Opponent features 37 state utility 28.0 No of pieces white 13 No of pieces black 10 To move Piece ==================== Chessstate Piece positionh6 X, Y (7, 5) wB c1BISHOPName B
There are 15 such moves, and then it is the opponent to play. This move during chessstate causes the opponent to become the player. This move during chessstate can only occur while calling the chesstate. mark method.
What to do about this piece of code in the .mark method? /*
Switch player after new action and analyzeutility has been performed olj 11.08.20
*/
if(playerTomove.getPlayerName() == playerTomove.getWhitePlayer()) {
whitePlayer.setActive(false);
blackPlayer.setActive(true);
}
if(playerTomove.getPlayerName() == playerTomove.getBlackPlayer()) {
whitePlayer.setActive(true);
blackPlayer.setActive(false);
}
if (whitePlayer.isActive())
playerTomove = whitePlayer;
else if (blackPlayer.isActive())
playerTomove = blackPlayer;
This issue has been solved by avoiding internal moves in the chesstate .mark method
The chessboard sometimes shows a piece (pawn) occupying two positions. This is a result of incorrect backtrack from movements made during minimax search.