Engine playing twice the same move in a CuteChess tournament

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Engine playing twice the same move in a CuteChess tournament

Post 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
Qui trop embrasse mal étreint.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

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

Post 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).
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

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

Post by Roland Chastain »

@H.G.Muller

Thank you. I will search in those directions.
Qui trop embrasse mal étreint.
Terje
Posts: 347
Joined: Tue Nov 19, 2019 4:34 am
Location: https://github.com/TerjeKir/weiss
Full name: Terje Kirstihagen

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

Post 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.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

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

Post 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.
Last edited by Roland Chastain on Sun Oct 18, 2020 1:15 pm, edited 1 time in total.
Qui trop embrasse mal étreint.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

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

Post 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.
Rasmus Althoff
https://www.ct800.net
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

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

Post 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 ?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

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

Post 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:
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

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

Post 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.
Qui trop embrasse mal étreint.