XBoard / 3check

Discussion of chess software programming and technical issues.

Moderator: Ras

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

XBoard / 3check

Post by Evert »

I added 3check as a variant in SjaakII, but I ran into an issue with XBoard if I try to run a self-play match (playing against the engine works fine): the second instance is sent "variant fairy" rather than "variant 3check".

Code: Select all

919 >first : memory 68
919 >first : new
random
919 >first : variant 3check
919 >first : level 40 0:10 0
919 >first : post
919 >first : hard
919 >first : easy
919 >first : ping 3
Impossible move , type = 0
921 >first : force
967 <first : setup (PNBRQKpnbrqk) 8x8+0_fairy rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -
recognized 'fairy' (-1) as variant fairy
recognized 'fairy' (-1) as variant fairy
shuffleOpenings = 0
FEN castling rights: 7 0 4 7 0 4
973 <first : piece N& N
973 <first : piece B& B
973 <first : piece R& R
973 <first : piece Q& Q
973 <first : piece K& KisO2
973 <first : piece P& fmWfceFifmW2
973 <first : pong 1
973 <first : pong 2
1064 <first : setup (PNBRQKpnbrqk) 8x8+0_fairy rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -
recognized 'fairy' (-1) as variant fairy
1064 <first : piece N& N
1064 <first : piece B& B
1064 <first : piece R& R
1064 <first : piece Q& Q
1064 <first : piece K& KisO2
1064 <first : piece P& fmWfceFifmW2
1064 <first : pong 3
StartChildProcess (dir=".") ./sjaakii
1067 >second: xboard
protover 2
1072 <second: Sjaak II version 475M (x86_64)
1073 <second: Type 'help' for a list of commands and help topics
1077 <second:  8[1m[46m[30mr [45m[30mn [46m[30mb [45m[30mq [46m[30mk [45m[30mb [46m[30mn [45m[30mr [0m
1077 <second:  7[1m[45m[30mp [46m[30mp [45m[30mp [46m[30mp [45m[30mp [46m[30mp [45m[30mp [46m[30mp [0m
1077 <second:  6[1m[46m  [45m  [46m  [45m  [46m  [45m  [46m  [45m  [0m
1077 <second:  5[1m[45m  [46m  [45m  [46m  [45m  [46m  [45m  [46m  [0m
1077 <second:  4[1m[46m  [45m  [46m  [45m  [46m  [45m  [46m  [45m  [0m
1077 <second:  3[1m[45m  [46m  [45m  [46m  [45m  [46m  [45m  [46m  [0m
1077 <second:  2[1m[46m[37mP [45m[37mP [46m[37mP [45m[37mP [46m[37mP [45m[37mP [46m[37mP [45m[37mP [0m
1077 <second:  1[1m[45m[37mR [46m[37mN [45m[37mB [46m[37mQ [45m[37mK [46m[37mB [45m[37mN [46m[37mR [0m*
1078 <second:   a b c d e f g h 
1078 <second: #[Chess] 0w>
1078 <second: feature setboard=1 time=1 sigint=0 colors=0 highlight=1 ping=1 memory=1 analyze=1 pause=1 nps=1 myname="Sjaak II 475M" myversion="[475M (x86_64)]" variants="fide_chess,wolves_and_sheep,maharaja,peasant,corridor_chess,legan,diamond_chess,diagonal_chess,corner_chess,ninth_century_indian_chess,troitzky_chess,troitzky_chess_byway,twilight_chess,judkins,omicron_chess,euroshogi,yarishogi,gorogoro_shogi,gorogoronl_shogi,cambodian,mini_xiangqi,elven,3check,shogi,seirawan,shatar,makruk,shatranj,sittuyin,crazyhouse,chessgi,asean,ai-wok,super,spartan,pocketknight,kingofthehill,knightmate,amazon,chancellor,berolina,losalamos,micro,capablanca,gothic,embassy,greatshatranj,courier,grand,opulent,omega,minishogi,shoshogi,shogi,torishogi,xiangqi,chess960,fischerandom,fischerrandom,nocastle,wildcastle,great,caparandom,minisho,5x5+5_shogi,tori,7x7+6_shogi,sho,9x9+0_shogi,king-of-the-hill,fairy,8x8+0_fairy,8x8+6_fairy,8x8+1_fairy,6x6+0_fairy,5x5+0_fairy,10x8+0_fairy,12x8+0_fairy,10x10+0_fairy,12x12+0_fairy,5x5+5_fairy,9x9+0_fairy,9x9+8_fairy,7x7+6_fairy,9x10+0_fairy,normal"
1078 >second: accepted setboard
1078 >second: accepted time
1078 >second: accepted sigint
1078 >second: accepted colors
1078 >second: accepted highlight
1078 >second: accepted ping
1078 >second: accepted memory
1078 >second: accepted analyze
1078 >second: accepted pause
1078 >second: accepted nps
1078 >second: accepted myname
1080 >second: rejected myversion
1080 >second: accepted variants
1080 <second: feature option="Variant fairy selects -combo chess (8x8+0) /// seirawan (8x8+0) /// shatar (8x8+0) /// makruk (8x8+0) /// shatranj (8x8+0) /// sittuyin (8x8+6) /// crazyhouse (8x8+6) /// chessgi (8x8+6) /// asean (8x8+0) /// ai-wok (8x8+0) /// super (8x8+0) /// spartan (8x8+0) /// pocketknight (8x8+1) /// kingofthehill (8x8+0) /// knightmate (8x8+0) /// amazon (8x8+0) /// chancellor (8x8+0) /// berolina (8x8+0) /// losalamos (6x6+0) /// micro (5x5+0) /// capablanca (10x8+0) /// gothic (10x8+0) /// embassy (10x8+0) /// greatshatranj (10x8+0) /// courier (12x8+0) /// grand (10x10+0) /// opulent (10x10+0) /// omega (12x12+0) /// minishogi (5x5+5) /// shoshogi (9x9+0) /// shogi (9x9+8) /// torishogi (7x7+6) /// xiangqi (9x10+0) /// fide_chess (8x8) /// wolves_and_sheep (8x8) /// maharaja (8x8) /// peasant (8x8) /// corridor_chess (8x8) /// legan (8x8) /// diamond_chess (8x8) /// diagonal_chess (8x8) /// corner_chess (8x8) /// ninth_century_indian_chess (8x8) /// troitzky_chess (10x10) /// troitzky_chess_byway (10x10) /// twilight_chess (8x8) /// judkins (6x6) /// omicron_chess (12x10) /// euroshogi (8x8) /// yarishogi (7x9) /// gorogoro_shogi (5x6) /// gorogoronl_shogi (5x6) /// cambodian (8x8) /// mini_xiangqi (7x7) /// elven (10x10) /// 3check (8x8) /// chess960 (= chess) /// fischerandom (= chess) /// fischerrandom (= chess) /// nocastle (= chess) /// wildcastle (= chess) /// great (= greatshatranj) /// caparandom (= capablanca) /// minisho (= minishogi) /// 5x5+5_shogi (= minishogi) /// tori (= torishogi) /// 7x7+6_shogi (= torishogi) /// sho (= shoshogi) /// 9x9+0_shogi (= shoshogi) /// king-of-the-hill (= kingofthehill)"
1080 >second: accepted option
1080 <second: feature option="Mate search -combo Disabled /// *Enabled for drop games /// Enabled"
1080 >second: accepted option
1080 <second: feature option="Draw offer threshold -spin 0 0 1000"
1080 >second: accepted option
1080 <second: feature option="Moves before draw offer (0 to disable) -spin 0 0 1000"
1080 >second: accepted option
1080 <second: feature option="Resign threshold -spin 500 100 16000"
1080 >second: accepted option
1080 <second: feature option="Moves before resigning (0 to disable) -spin 0 0 1000"
1080 >second: accepted option
1080 <second: feature option="Send 'piece' descriptions -check 1"
1080 >second: accepted option
1080 <second: feature option="Mark holes in board -check 1"
1080 >second: accepted option
1080 <second: feature option="List user-defined variants before buildin variants -check 1"
1080 >second: accepted option
1080 <second: feature option="Report fail low -check 1"
1080 >second: accepted option
1080 <second: feature option="Report fail high -check 1"
1080 >second: accepted option
1080 <second: feature option="Claim repetitions -check 1"
1080 >second: accepted option
1080 <second: feature option="Set variant alias -string fairy=shogi"
1080 >second: accepted option
1080 <second: feature option="Variant configuration file -file /Users/eglebbk/Program/Sjaakii/variants.txt"
1080 >second: accepted option
1080 <second: feature done=1
1080 >second: accepted done
1081 >second: memory 68
1081 >second: new
random
1081 >second: variant fairy
1081 >second: level 40 0:10 0
1081 >second: post
1081 >second: hard
1081 >second: easy
1081 >second: ping 1
Impossible move , type = 0
1082 >second: force
1176 <second: setup () 9x9+7_shogi lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL [-] w 0 1
1176 <second: piece P& fWf@8
1176 <second: piece L& fR@8
1176 <second: piece N& ffN@7
1176 <second: piece S& FfW
1176 <second: piece B& B
1176 <second: piece R& R
1176 <second: piece G& WfF
1176 <second: piece K& mcpaKmcabK
1176 <second: piece +P& WfF
1176 <second: piece +L& WfF
1176 <second: piece +N& WfF
1176 <second: piece +S& WfF
1176 <second: piece +B& BW
1176 <second: piece +R& RF
1176 <second: pong 1
write FEN 50-move: 0 0 0
e0. p=-6
1182 >second: setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Two Machines
New game (1): Sjaak II 475M-Sjaak II 475M (w)
1183 >first : computer
1183 >second: computer
1183 >first : time 1000
1183 >first : otim 1000
book hit = (NULL)
1183 >first : go
nps: w=-1, b=-1
1183 <second: Error: unknown piece type 'q' (bad FEN rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1)
1185 <first :   2    -2      0       120  1.  d4 Nf6
Impossible move , type = 32
1189 <first :   3     8      0       147  1.  d4!
Impossible move , type = 32
1189 <first :   3    29      0       175  1.  d4!
Impossible move , type = 32
1189 <first :   3    45      0       258  1.  d4 Nf6 2. Nc3
Impossible move , type = 32
1190 <first :   4    32      0       771  1.  d4?
Impossible move , type = 32
1194 <first :   4    -6      1      2123  1. Nf3  d6 2. Nc3 Nf6
Impossible move , type = 32
1197 <first :   5     4      1      2738  1. Nf3!
Impossible move , type = 32
1200 <first :   5    24      1      3510  1. Nf3!
Impossible move , type = 32
1209 <first :   5    35      2      5816  1. Nf3  d5 2.  d4 Nf6 3. Nc3
Impossible move , type = 32
1228 <first :   6     0      4     11249  1. Nf3  d5 2.  d4 Nf6 3. Nc3 Nc6
Impossible move , type = 32
1231 <first :   7    10      4     12063  1. Nf3!
Impossible move , type = 32
1236 <first :   7    30      5     13243  1. Nf3!
Impossible move , type = 32
1242 <first :   7    30      5     15180  1. Nf3  d5 2.  d4 Nf6 3. Nc3 Nc6 4. Bf4
Impossible move , type = 32
1336 <first :   8     3     15     36833  1. Nf3  d5 2.  d4 Nf6 3. Bf4 Nc6 4.  e3 Bf5
Impossible move , type = 32
1337 <first : move g1f3
1338 >second: time 1000
1338 >second: otim 984
book hit = (NULL)
1338 >second: g1f3
1338 >second: go
1445 <second: Error (Illegal move or unknown command): g1f3
1450 <second: 0-1 {No white pieces remaining}
User avatar
hgm
Posts: 28480
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard / 3check

Post by hgm »

The problem is that the 1st engine tries to overrule the variant to 'fairy' in its setup command, and that XBoard takes that seriously. But 3check is a standard variant, so you are not supposed to do send a setup command that mentions a parent variant there. At least not a different one.

I guess XBoard could be made more robust by ignoring the parent-variant field when the current variant is not VariantUnkown.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: XBoard / 3check

Post by Evert »

hgm wrote:The problem is that the 1st engine tries to overrule the variant to 'fairy' in its setup command, and that XBoard takes that seriously. But 3check is a standard variant, so you are not supposed to do send a setup command that mentions a parent variant there. At least not a different one.
Good catch. I defined the variant through the config file, but then SjaakII always sends a setup command. I guess I should add a way to suppress that if needed, but I don't want to put too much XBoard-specific stuff in there. As a work-around I'll define 3check as the parent, which should make the error go away in this case.

Something about this still doesn't make sense to me though: if I have a user-defined variant the second engine is told to set that variant, not the parent variant...
User avatar
hgm
Posts: 28480
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard / 3check

Post by hgm »

The reason is that for unrecognized variant names XBoard sets the variant to Unknown, and remembers the actual name. That the latter is not a null string is used as indication by XBoard that it is playing an engine-defined variant after the setup command has reset the interal variant to the parent. But for a standard variant the "engine-defined name" remains a null string.

It is necessary to treat engine-defined variants different from standard variants, because in the latter case you want to ignore the setup command when legality checking is on, (and the board width is not overruled), to prevent cheating. While for engine-defined variants a setup command is never ignored, and even mandatory.