UCI error codes?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: UCI error codes?

Post by Evert »

hgm wrote:Fairy-Max can only castle with a corner piece. (Dont know about Sjaak II.)
Well, that's a bit annoying. In principle it can do any castling move that you like. In practice, the FEN parser requires that the pieces are on the same rank (but there are no other restrictions; I don't remember if I finished it, but most of the code can handle an arbitrary number of defined castling moves).
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: UCI error codes?

Post by Evert »

hgm wrote:But of course standard UCI doesn't address variants at all. For the purpose of running the Stockfish variant engine in variants like Horde and King of the Hill we made an extension to UCI, where setting an UCI_Variant option would cause the engine to send an "info string variant ..." response with details about the variant (in this case just the initial setup), in analogy with the "setup" command in WB protocol.
Oooh, I didn't know that was added! Is the format for the info string documented somewhere?
User avatar
hgm
Posts: 27810
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI error codes?

Post by hgm »

Not really. But running Stockfish-variant gives this:

Code: Select all

Stockfish 301216 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
uci
id name Stockfish 301216
id author T. Romstad, M. Costalba, J. Kiiski, G. Linscott

option name Debug Log File type string default
option name Contempt type spin default 0 min -100 max 100
option name Threads type spin default 1 min 1 max 128
option name Hash type spin default 16 min 1 max 2048
option name Clear Hash type button
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 500
option name Skill Level type spin default 20 min 0 max 20
option name Move Overhead type spin default 30 min 0 max 5000
option name Minimum Thinking Time type spin default 20 min 0 max 5000
option name Slow Mover type spin default 89 min 10 max 1000
option name nodestime type spin default 0 min 0 max 10000
option name UCI_Chess960 type check default false
option name UCI_Variant type combo default chess var chess var giveaway var atom
ic var crazyhouse var horde var kingofthehill var losers var racingkings var thr
eecheck var suicide var loop
option name SyzygyPath type string default <empty>
option name SyzygyProbeDepth type spin default 1 min 1 max 100
option name Syzygy50MoveRule type check default true
option name SyzygyProbeLimit type spin default 6 min 0 max 6
uciok
isready
readyok
setoption name UCI_Variant value horde
info string variant horde startpos rnbqkbnr/pppppppp/8/1PP2PP1/PPPPPPPP/PPPPPPPP/PPPPPPPP/PPPPPPPP w kq - 0 1
Current UCI2WB just looks for the 'startpos <fen>' part to construct a CECP 'setup' command, where it always uses 8x8+0_fairy as parent, and the pieceToCharTable for normal Chess. (As at the moment all non-standard variants Stockfish plays are of that type.) I suppose it could get the board size from scrutinizing the FEN. I have no idea yet how to solve the pieceToCharTable problem.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: UCI error codes?

Post by Evert »

hgm wrote:Not really. But running Stockfish-variant gives this:

Code: Select all

Stockfish 301216 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
uci
id name Stockfish 301216
id author T. Romstad, M. Costalba, J. Kiiski, G. Linscott

option name Debug Log File type string default
option name Contempt type spin default 0 min -100 max 100
option name Threads type spin default 1 min 1 max 128
option name Hash type spin default 16 min 1 max 2048
option name Clear Hash type button
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 500
option name Skill Level type spin default 20 min 0 max 20
option name Move Overhead type spin default 30 min 0 max 5000
option name Minimum Thinking Time type spin default 20 min 0 max 5000
option name Slow Mover type spin default 89 min 10 max 1000
option name nodestime type spin default 0 min 0 max 10000
option name UCI_Chess960 type check default false
option name UCI_Variant type combo default chess var chess var giveaway var atom
ic var crazyhouse var horde var kingofthehill var losers var racingkings var thr
eecheck var suicide var loop
option name SyzygyPath type string default <empty>
option name SyzygyProbeDepth type spin default 1 min 1 max 100
option name Syzygy50MoveRule type check default true
option name SyzygyProbeLimit type spin default 6 min 0 max 6
uciok
isready
readyok
setoption name UCI_Variant value horde
info string variant horde startpos rnbqkbnr/pppppppp/8/1PP2PP1/PPPPPPPP/PPPPPPPP/PPPPPPPP/PPPPPPPP w kq - 0 1
Current UCI2WB just looks for the 'startpos <fen>' part to construct a CECP 'setup' command, where it always uses 8x8+0_fairy as parent, and the pieceToCharTable for normal Chess. (As at the moment all non-standard variants Stockfish plays are of that type.) I suppose it could get the board size from scrutinizing the FEN. I have no idea yet how to solve the pieceToCharTable problem.
Ok, thanks!
I suppose I could always proactively define fields for the missing information. Currently the only use would be to run Sjaak II in UCI mode under XBoard, which seems needlessly complicated.
User avatar
hgm
Posts: 27810
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI error codes?

Post by hgm »

Obvious extensions would be to provide other info needed to forge it into a CECP 'setup' command. This would be holdings size, parent variant and pieceToCharTable. But this basically 'leaks' CECP into UCI, as what are standard variants that could be used as parent is a CECP issue. And the pieceToCharTable is even XBoard-specific (i.e. depends on the GUI implementation). So I don't like that much. Even in CECP I would like to get rid of the pieceToCharTable.

Of course there also are the CECP 'piece' commands. Perhaps a more natural extension to UCI would be to define

info string piece <id> name <long name> move <betza movespec> image <hints> promotion <list>

which would tell the GUI which piece types participate in the variant, and how they move. (Default could be the FIDE pieces PNBRQK in so far they are mentioned in the starpos FEN.) It could also provide a hint as to what image to use for the piece; GUIs could have a list of descriptions for all their built-in piece images (e.g. "archbishop,cardinal" or "wolf,dog"), and match that with the hint to see if one is suitable (and take the next-available image otherwise). Or it could load external images provided by the user, as image file, e.g. wolf.svg or wolf.bmp, or whatever graphics type the GUI uses. All at the discretion of the GUI designer.

The <long names> could be used in the promotion popup; the <list> would indicate (by <id>) which pieces should be selectable there (and imply whether there is any choice at all).

The parent variant could be replaced by a set of individual rule flags, in a command

info string rules [stalemate <result>] [royal <id>] [promozone <depth>|<list>] ...