Move counter=1?

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Move counter=1?

Postby Michel » 11 Dec 2010, 15:36

I noticed a strange difference in behaviour when gnuchess plays under xboard and in console
mode. It took me a while to track down but I finally found it.

When setting up a position xboard apparently changes the move counter to 1. This
has the effect that gnuchess thinks it is still in the opening and consequently
it evaluates things slightly differently (e.g. it will penalize the movement of
pieces not on their starting square).

It seems to me that xboard should not change the move counter...

Of course one may argue if it is wise of gnuchess to take the move counter into
account in its evaluation but that is another question.
Michel
 
Posts: 513
Joined: 01 Oct 2008, 12:15

Re: Move counter=1?

Postby H.G.Muller » 24 Dec 2010, 17:28

Indeed WinBoard always assumes a setup position is move 1. The Edit Position mode does not provide a way to enter a move number. But in principle pasting FENs could be used to set a move number fdifferent from 1.

I am afraid that this might have all kinds of unintended effects. E.g. how should we handle time control when we start from a position that says move nr 23? If we are playing 40/60, should we give new time after 17 moves, or after 40? And will engines understand this automatically, or must we fudge the level command? What about engines that do not understand setboard?

I think the best solution for GNU Chess is to derive an assumed move number from the given initial position (e.g. based on number of pieces and Pawns in their initiall position), and use that in stead the number actually given in the FEN.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby Michel » 24 Dec 2010, 20:52

E.g. how should we handle time control when we start from a position that says move nr 23? If we are playing 40/60, should we give new time after 17 moves, or after 40?


It seems to me that this should be handled exactly the same as executing 23 moves in force mode... I think this is what you also said a while ago. In any case I think this should be specified in the spec as it is not guaranteed that all GUI's will send FEN's with move counter equal to 1.
Michel
 
Posts: 513
Joined: 01 Oct 2008, 12:15

Re: Move counter=1?

Postby H.G.Muller » 25 Dec 2010, 09:17

That would be a logical spec. But I am still afraid that implementing faithful passing of the move number would break many engines with many sets of starting positions. Starting positions are often derived from games by saving the position, and will have move number > 1 in that case.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby Miguel A. Ballicora » 25 Dec 2010, 20:16

H.G.Muller wrote:That would be a logical spec. But I am still afraid that implementing faithful passing of the move number would break many engines with many sets of starting positions. Starting positions are often derived from games by saving the position, and will have move number > 1 in that case.


You would not break any engines, they would be broken already (I need to check Gaviota). If someone would like to test those engines with fen positions, they could set the fen positions with the clock number to 1 and be honest about it. Users who use fen positions with a clock number and at the same time pretending the number to be ignored is crazy lazy. If a user wants the number to be 1, then they should set it to 1. At least, you may provide a switch "-ignoreFENclock" for lazy users :-), but as default stick to the standards, which are not set to be ignored.

Anyway, using FEN positions rather than PGN is not a good idea anyway but that is another issue.

Miguel
User avatar
Miguel A. Ballicora
 
Posts: 160
Joined: 03 Aug 2005, 02:24
Location: Chicago, IL, USA

Re: Move counter=1?

Postby chessp » 20 Jan 2015, 12:15

i use winboard to enter otb games which sometimes contain illegal moves. at first i simply deactivated the legality check, but this doesnt satisfy me, especially since engines cant analyze positions after an illegal move.

so i got the idea of ending a game before the illegal move, edit the position to reflect the illegal move and then start a new game with this fen. unfortunately even if i edit the last parameter of the fen, winboard always treats it as 1 and the second game doesnt start at say move 35 as it should, but at 1 again.

please fix or suggest a workaround.

thanks.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 20 Jan 2015, 15:20

Indeed, when you set up a position, it starts a new game. WinBoard is nor smart enough to realize that the edit just differs from the original position by one illegal move.

Even with legality checking off entering illegal moves should not work with an engine: the engine will refuce the move with an 'Illegal move' command, upon which WinBoard will take the move back.

There is a volatile option -forceIllegalMoves true , however, which makes WinBoard do exactly what you are now trying to do by hand: if an engine does not accept the move the user or opponent engine just played, as evidenced by the engine's "Illegal move" response to it, WinBoard does not take back the move, but in stead forces the current position on the engine through a setboard (or edit) command. Without starting a new game. This option isn't well tested, however; I only ever used it to play one 10x8 variant with deviating castling rules as another. It probably would not work in combination with retracting moves.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 20 Jan 2015, 16:10

where do i put this option? on the command line used to launch winboard? or in command line used to call the engines?
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 20 Jan 2015, 17:02

It is something WinBoard does, so on the WinBoard command line. (Or in the 'Additional options' field of the startup dialog.) The engine knows nothing about it.

Above I was wrong, btw: you just have to give the -forceIllegalMoves, no following 'true'. It is false by default, and mentioning it makes it true.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 20 Jan 2015, 17:27

ok it prevents rejection of the illegal move, but analysis mode still doesnt work. the output windows just doesnt change any more, even if i move back before the illegal move.

why is the fen move counter ignored? shouldnt be hard to read it and add it to the number of the current move in the move history.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby chessp » 20 Jan 2015, 17:32

hm. it works if i start a new game. i can move the pieces just anywhere and analysis works fine for the new position.

but if a load a game from a .pgn file, analysis stops the moment it encounters the illegal move.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 20 Jan 2015, 17:53

You mean in AnalyzeGame mode? Or when stepping through the game by hand in analysis mode?

I looked at the code, and it does indeed put the engine in force mode before sending it the position. Only when the engine was playing, it then receives a 'go' command to let it continue playing. I guess if the old mode would have been analysis, it should have sent the 'analyze' command. But it doesn't. This is not really a documented feature, just a private hack that I needed during a machine match.

So we end up in a situation wher WinBoard is still in analyze mode, but the engine is in an undefined state, as 'force' should not really be used to take it out of analyze mode. (The 'exit' command is for that.) You might try to switch to Edit Game mode after the engine stopped analyzing, and then to Analyze mode again.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby H.G.Muller » 20 Jan 2015, 17:58

chessp wrote:why is the fen move counter ignored? shouldnt be hard to read it and add it to the number of the current move in the move history.

It is not intended to arbitrarily alter positions within an existing game. This would in general produce complete discontinuities in the game, where one position would have no relation whatsoever to the position on the previous move. So pasting a FEN (or using Edit Position) would always open a new game. The only difference if it would not ignore the move number would be that the move numbers in this new game are different, and do not start at one, the preceding moves missing. This is an irrelevant difference, so we never bothered.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 20 Jan 2015, 18:03

always analysis mode, i dont really know what analyze game does.

i am aware that the two games before and after the fen have nothing to do with each other, i even give them different names. all i am complaining about is that the numbers in the history are wrong. this difference might be trivial but helps a human to orient himself in a game.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 20 Jan 2015, 19:32

I posted a new WinBoard version, which puts the engine back in analyze mode after having forced an illegal move: http://hgm.nubati.net/winboard.zip .

It would still not be possible to back up beyond the illegal move, once you passed it, though. (XBoard does use the 'undo' command for that, but the engine will consider a loaded postion the first position of a new game as well, and will thus refuse the undo.)
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 20 Jan 2015, 20:02

no change. analysis stops when clicking through the moves reaches the illegal one.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 20 Jan 2015, 23:13

OK, try the next version at the same link. The previous one still had a bug: it sent the last position of the game to the engine after an illegal-move complaint, rather than the current position. When the engine is playing those are always the same.But during analysis you can be in the middle of the game when feeding moves to the engine.

For me this version seemed to work, provided that I set the automatic stepping rate equal to -1 in the Load Game Options dialog. This prevents the game being completely fed to the engine already during game load, after which you could not back up to the beging anymore past an illegal move. After Load Game, which then leaves the game in the initial position, I then start Analysis Mode. Then I can step forward through the game, including the illegal move, and the analysis nicely follows the displayed position. (Legality testing is off all the time, of course.)
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 21 Jan 2015, 08:35

thank you, it works! steppig backwards to before the illegal move does indeed not work, but the workaround is easy, since stepping forwards works anywhere.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 21 Jan 2015, 10:46

If I can also make it work on stepping backwards I could include it as an official option in the next WinBoard release. Stepping backward over an illegal move is more difficult, though. For one, there is no standard response of an engine when it receives 'undo' in the position that was loaded through 'setboard', like there is for feeding it an illegal move. So WinBoard would have to remember which moves were illegal. And then reload the position after the previous illegal move (or the start position) and all following legal moves to the engine when you back up over an illegal move. I already do that for null moves that are in the game or variation. But null moves are of course easy to recognize, and by definition illegal.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 21 Jan 2015, 14:21

how does winboards legality check work? it doesnt require an engine, so winboard seems to know by itself which moves are illegal. i suggest adding and illegal tag as a comment and also displaying illegal moves using a red instead of a yellow arrow. i suggested this before but got no reply.

my step back workaround is two steps back one forward. why dont you use setboard after each move in the first place? do engines reuse their "thoughts" from previous moves? you could add a menu entry called "analyze by position" which would behave exactly as analysis mode, but use setboard every time.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Next

Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 2 guests