Illegal moves fix and other improvements #9
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The two illegal moves in #8 (against TSCP and the first against EnkoChess) have been resolved. An oversight in move generation caused Apollo to not see an en passant capture as a valid way to leave check, causing the last move of the
position
command to not be recognized and Apollo to think it was playing the opposite side of the board.Although I could not replicate the second illegal move against EnkoChess, I could replicate Apollo fumbling its way through winning endgames (especially KRvK). With some changes to how the mate score is returned from the evaluation function and how it is stored and retrieved in the transposition tables, Apollo should no later attempt such circuitous routes to mating.
Some other minor issues were touched on. Illegal moves should occur far less frequently in PV output (although they still show up occasionally). An issue with De Morgan's Law was fixed in FEN string creation. Also, the engine no longer stalls and/or disconnects at plies 319 and beyond. There are still time management issues, unfortunately. Finally, I found a way to push back calling
Eval::evaluate
until after looking through the transposition table, which speeds up iterative deepening quite nicely.I ran 60 game pairs (4-ply book, 40 moves/1 minute) to compare versions.
PGN of the games
Do I think these fixes gained 180 ELO? No. I estimated they gained closer to 60. Considering there are a lot of TODOs still in the code and some pesky loses on time and illegal pv moves, there is still plenty of work to do. However, this is significant enough progress that I think it is worth making the pull request here.