Open tinitus-git opened 3 years ago
OK I think I understand the issue....at least on a theoretical level. The fen string that I gave would never happen in a real classical game of chess. The problem is that the white king is in check and it is black's move. This would never happen in an actual real game of chess because white would have to get him or herself out of check on their move.
My game is a slight variation of chess and this situation can come up. I think I know what to do about this exception, but if there are any thoughts you have, please let me know.
I have the following FEN string:
r1b1kb1r/pppp1ppp/2n1p3/8/1PPPnP1q/8/P5PP/RNBQKBNR b - b3 0 1
which is causing an index out of bounds exception in RemovePieceAtSquare. Here is the callstack:
IndexOutOfRangeException: Index was outside the bounds of the array. PieceList.RemovePieceAtSquare (System.Int32 square) (at Assets/Scripts/Core/PieceList.cs:29) Chess.Board.MakeMove (Chess.Move move, System.Boolean inSearch) (at Assets/Scripts/Core/Board.cs:79) Chess.Search.SearchMoves (System.Int32 depth, System.Int32 plyFromRoot, System.Int32 alpha, System.Int32 beta) (at Assets/Scripts/Core/AI/Search.cs:176) Chess.Search.StartSearch () (at Assets/Scripts/Core/AI/Search.cs:77) Chess.Game.AIPlayer.StartSearch () (at Assets/Scripts/Core/AIPlayer.cs:69) Chess.Game.AIPlayer.NotifyTurnToMove () (at Assets/Scripts/Core/AIPlayer.cs:56) Chess.Game.GameManager.NotifyPlayerToMove () (at Assets/Scripts/Core/GameManager.cs:175) Chess.Game.GameManager.NewGame (Chess.Game.GameManager+PlayerType whitePlayerType, Chess.Game.GameManager+PlayerType blackPlayerType) (at Assets/Scripts/Core/GameManager.cs:121) Chess.Game.GameManager.Start () (at Assets/Scripts/Core/GameManager.cs:56)
The fen string seems to be ok but I am seeing this error in my own application and when I force it in the chess-ai-main application.
Thanks,
Brian