Move counter=1?

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

Moderators: hgm, Andres Valverde

Re: Move counter=1?

Postby H.G.Muller » 21 Jan 2015, 17:05

Ah yes, I remember now. You caught me at a bit of an unfavorable time: I was in a hotel on Gran Canaria, and my wife had just broken here lower leg in two places during a mountain hike there. That kept me heavily occupied. I am just starting to recover a bit from that. (For my wife it will unfortunately still take a lot longer...)

As to your question: WinBoard does have its own move generator, on which it can base legality checking. This is a later addition, however; originally it was just the graphical front end of GNU Chess, and the latter was responsible for the legality checking of input moves. So any move would be accepted by WinBoard (except with empty squares or opponent pieces, or moves ending off board and such obviously illegal things), and then sent to the engine, and the engine could then reject it with an error message, which would then make WinBoard undo the move and notify the user. It still works that way when legality testing is switched off. But with legality testing on WinBoard would not even relay illegal moves to the engine, and make the piece jump back to its starting square as soon as you release it.

It would indeed be necessary to store a flag with each move to indicate the legality. We cannot trust on running WinBoard's own legality test acting on the move, for that purpose, as the main reason that people swicth legality testing off is to play variants that have rules different from what WinBoard would think. WinBoard and the engine then do not agree on legality, but WinBoard is silenced by suppressing its testing. If we have that, I guess indicating illegal moves with a red arrow becomes easy. The flag would only be set if the engine rejected the move.

Engines essentially also start a new game after setboard. Meaning they lose memory of everything that happened before it. So sending them a setboard on every position would make it impossible for them to recognize 3-fold repetitions.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 23 Jan 2015, 09:35

i've been working successfully with -forceIllegalMoves until today i manged to crash stockfish with this:

[Event "crash stockfish"]
[Site "-"]
[Date "-"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "*"]

{moves 9 and 15 were added to model clumsy handling of pieces.}
1. e4 e5 2. f3 Nc6 3. Nh3 Bc5 4. Ng5 Qxg5 5. Bb5 a6 6. Bf1 Nf6 7. f4 exf4
8. Bb5 axb5 9. -- d6
10. Rf1 Bg4 11. Rh1 Bxd1 12. Kxd1 Bd4 13. e5 dxe5 14. g4 Qxg4+ 15. d2c3 --+

illegal, null and chess in one move seems to be too much. ;-)
if i interchange "moves" 14 and 15, it works.


it seems winboard is more geared towards playing chess instead of documenting it. i seem to have quite some requirements, which dont make much sense in the current setting. maybe in order to not disturb everything that already exists, there could be a separate "otb mode" which would handle all my requests? e.g. make legality check only warn and insert {illegal} comment instead of rejecting the move and when analyzing behave like with -forceIllegalMoves on (or even setboard each turn which might prevent the error i documented above), and then fancy stuff like coloring illegal moves and their arrow. maybe even allow fens in the middle of a game (for accidental repositioning which was not an intentional move), though i dont know if the .pgn format supports this.
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 23 Jan 2015, 11:51

This sounds like a Stockfish problem, and there doesn't seem a whole lot that WinBoard can do about it. Apparently Stockfish chokes on the fact that you allow it to capture a King. (Fairy-Max plays 15... Bxc3# here! :D )

Moving pieces like they are not supposed to go is one thing, but leaving your King in check is quite another. In the first case it can be repaired by sending the position after the move to the engine. But when engines crash by sending them positions where they can capture the King, this is no longer an option.

So what do you expect WinBoard to do? It cannot know what positions the engine will crash on. It cannot even be sure that the King was left in check, because legality testing is off, and this might be a variant where the Queen can only move two steps. Or it could be a sort of extinction Chess, where it is perfectly legal to let your King be captured, and you lose only once you have no Pawns left.

IMO the engine should have claimed the game here, indicating QxK as best move. As Stockfish is UCI, it is running under Polyglot, so I don't know if the crash is due to Stockfish or Polyglot.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 23 Jan 2015, 12:59

i agree that it cant be called a winboard problem if it is abused that much. ;-)

priority for treatment is low, lower than the other stuff i suggested at the end. but one could think about just writing "engine crash" to the engine output window and silently restart the engine, so that it's ready for the next move. if one doesnt like this as default behaviour, it could be active only when in "otb mode" or have an option "graceful engine crash".
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

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

Well, I am fundamentally opposed to cater to engine non-compliancy in the GUI. It will just encourage people to produce crappy non-compliant engines. Restarting engines that crash would remove all incentive to produce engines that never crash.

The WB protocol specs actually do tell how engines are supposed to behave when they receive an invalid position (and crashing was not amongst the options...): when asked to move later, they should consider any move illegal, and emit the corresponding error message. This would solve the problem of leaving your King in check: WinBoard could just send the position to the engine (which would probably respond with some non-standardized 'Error' command ignored by WinBoard), and the attempt to move to the position after it would encounter an "Illegal move" response, so that WinBoard would again force the position. This would continue until the position is legal again, and followed by a legal move.

So I guess this is really a Polyglot problem, which is surprising, as Polyglot is one of the most pedantic programs I know. It should check the position for properties that the engine might conceivably choke on (like Pawns on 1st/8th rank, multiple Kings, and King up for grabs), and then apply the prescription of the protocol specs to refuse any subsequent move as illegal, until a legal position is loaded (possibly implicitly by starting a new game). I will check if I can fix this in Polyglot, which should then solve the problem for you, without the need to make WInBoard do all kind of weird and undesirable things.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 23 Jan 2015, 14:14

sounds good. have you also registered the suggestions about "otb mode"?
chessp
 
Posts: 27
Joined: 03 Dec 2014, 08:54

Re: Move counter=1?

Postby H.G.Muller » 23 Jan 2015, 14:42

Well, I don't see much benefit in packaging features in a complete new mode; it just seems to make things less flexible. If new features are needed it would usually be better to make it possible to switch them on independently and orthogonally.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Move counter=1?

Postby chessp » 23 Jan 2015, 17:15

i agree but i sensed a hesitation to change too much of the well established things.

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

Previous

Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 6 guests