My engine is making weird or ilegal moves in games roughly around move ~40-50. And when i plug the FEN in the engine afterwards it actually prints the correct (non ilegal) move. Any ideas on what could be causing this and how to debug? Additionally, when I plug the FEN into the engine after the game it prints the correct/reasonable non-ilegal move.
e.g in this position it plays Rc6 (as white), which makes no sense and hangs a queen:
[fen]4rrk1/3R1p2/R4Pq1/8/P1p1P2P/2P3Q1/2B3P1/6K1 w - - 1 44[/fen]
And after the game, when I plug the FEN it gives g3g6, which is the obvious move of course.
another example, here it plays "h8g7" (as black), which is completely ilegal:
[fen]8/6k1/6p1/6P1/1pBb3P/6K1/5P2/8 b - - 7 43[/fen]
And obviously when I give the position to it again it doesn't give an ilegal move...
I would really appreciate any help as to what could be causing this and how I could debug.
Engine making ilegal or nonsensical moves at move ~40-50
Moderator: Ras
-
- Posts: 5
- Joined: Sun Apr 03, 2022 6:28 pm
- Full name: Lucas Oliveri
-
- Posts: 325
- Joined: Tue Aug 31, 2021 10:32 pm
- Full name: tcusr
Re: Engine making ilegal or nonsensical moves at move ~40-50
when bugs come and go is usually fault of uninitialized variables.OliveriQ wrote: ↑Fri May 20, 2022 11:45 pm My engine is making weird or ilegal moves in games roughly around move ~40-50. And when i plug the FEN in the engine afterwards it actually prints the correct (non ilegal) move. Any ideas on what could be causing this and how to debug? Additionally, when I plug the FEN into the engine after the game it prints the correct/reasonable non-ilegal move.
e.g in this position it plays Rc6 (as white), which makes no sense and hangs a queen:
[fen]4rrk1/3R1p2/R4Pq1/8/P1p1P2P/2P3Q1/2B3P1/6K1 w - - 1 44[/fen]
And after the game, when I plug the FEN it gives g3g6, which is the obvious move of course.
another example, here it plays "h8g7" (as black), which is completely ilegal:
[fen]8/6k1/6p1/6P1/1pBb3P/6K1/5P2/8 b - - 7 43[/fen]
And obviously when I give the position to it again it doesn't give an ilegal move...
I would really appreciate any help as to what could be causing this and how I could debug.
-
- Posts: 16
- Joined: Sat Dec 12, 2020 5:29 am
- Full name: Ben Bradley
Re: Engine making ilegal or nonsensical moves at move ~40-50
My offhand guess would be a buffer overflow or similar memory allocation issue.
-
- Posts: 640
- Joined: Fri Mar 30, 2018 7:20 am
- Full name: Andreas Matthies
Re: Engine making ilegal or nonsensical moves at move ~40-50
Sounds similar to a problem I remember that Schooner had when playing in UCI mode. The buffer for the "moves ..." input was too small.
Regards, Andreas
Regards, Andreas
-
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: Engine making ilegal or nonsensical moves at move ~40-50
State you are using in your program not only dependent on position(fen). So disable parts of state and find which part of state is causing the bug. Better not use state at all so you won't get these annoying non-reproducable bugs.
-
- Posts: 2696
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Engine making ilegal or nonsensical moves at move ~40-50
That's not the same situation because in UCI, the engine probably gets "position startpos moves (all game moves)". Try using that as input when starting your engine directly from the commandline. As Andreas said, it sounds like a problem with the input buffer.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net