Page 1 of 1

Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 10:48 am
by Roland Chastain
Hello!

Sometimes, with CuteChess, I have games ending by illegal move, and when I look into the PGN, I see that the engine seems to have played twice the same move consecutively. It happens with several engines, some engines of mine, and some other. Until now I didn't manage to understand what happens. Have someone else yet experienced the same thing?

In case my explanation wouldn't be clear enough, I attach the PGN of a game in which the problem happened.

Regards.

Roland

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 10:59 am
by hgm
This typically happens when the engine's search doesn't find any move to play at all (in other words, considers itself check- or stalemated), while the GUI disagrees (and thus has not declared game end already, but sets the engine thinking). Usually this means the engine has a move bug, and GUIs tend to be infallible. But it can also happen when legality testing or mate detection in the GUI has been switched off, and the opponent did not claim the game (which only CECP engines can do) after it delivered the death blow.

The root search then never saves anything as best move, so that the corresponding variable still holds the move of the previous turn (or perhaps that of the opponent, depending on how you have coded this).

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 11:20 am
by Roland Chastain
@H.G.Muller

Thank you. I will search in those directions.

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 12:28 pm
by Terje
Can also happen if the last moves before this were discarded for any reason (input buffer too small, incorrect validation of moves..), as the engine would think it was playing the same position again.

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 12:49 pm
by Roland Chastain
Terje wrote: Sun Oct 18, 2020 12:28 pm Can also happen if the last moves before this were discarded for any reason (input buffer too small, incorrect validation of moves..), as the engine would think it was playing the same position again.
Ah, yes, there is also that possibility. I didn't think of it. Thank you.

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 12:51 pm
by Ras
hgm wrote: Sun Oct 18, 2020 10:59 amThe root search then never saves anything as best move, so that the corresponding variable still holds the move of the previous turn (or perhaps that of the opponent, depending on how you have coded this).
That's why I maintain a validity flag after evaluating the "position" command (UCI). If the FEN or the move list is illegal, I write out the problem's cause with "info string error (problem description)". A subsequent "go" command will be answered with "bestmove 0000". Then it's easy to evaluate log files and see what went wrong.

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 1:11 pm
by lucasart
Roland Chastain wrote: Sun Oct 18, 2020 10:48 am Hello!

Sometimes, with CuteChess, I have games ending by illegal move, and when I look into the PGN, I see that the engine seems to have played twice the same move consecutively. It happens with several engines, some engines of mine, and some other. Until now I didn't manage to understand what happens. Have someone else yet experienced the same thing?

In case my explanation wouldn't be clear enough, I attach the PGN of a game in which the problem happened.

Regards.

Roland
Your engine has a bug, which I pointed out in another thread (about c-chess-cli). When receiving "position fen ... moves ...", it discards the moves. Have you fixed it ?

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 1:24 pm
by Roland Chastain
lucasart wrote: Sun Oct 18, 2020 1:11 pm Your engine has a bug, which I pointed out in another thread (about c-chess-cli). When receiving "position fen ... moves ...", it discards the moves. Have you fixed it ?
Yes, it's true, but I don't believe this be the same problem. For traditional chess, CuteChess uses "position startpos ..." syntax. And, in that case, the engine that seems to play illegal move is not mine (it's Iota 0.1).

And yes, I fixed the bug, but not yet released the new version. :wink:

Re: Engine playing twice the same move in a CuteChess tournament

Posted: Sun Oct 18, 2020 1:29 pm
by Roland Chastain
Ras wrote: Sun Oct 18, 2020 12:51 pm That's why I maintain a validity flag after evaluating the "position" command (UCI). If the FEN or the move list is illegal, I write out the problem's cause with "info string error (problem description)". A subsequent "go" command will be answered with "bestmove 0000". Then it's easy to evaluate log files and see what went wrong.
Good idea. I should do something like that.