Sjaak II, Wa Shogi and XBoard 4.9

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Sjaak II, Wa Shogi and XBoard 4.9

Post by hgm »

Does the standard version of Sjaak II play Wa Shogi?

Now that the number of piece types in XBoard has been extended from 44 to 66, and there is no fixed pairing of promoted and unpromoted types, it is possible to make a much more satisfactory assignment of pieces. So the 1-kanji-wa piece theme we are going to supply (as well as the Mnemonic-S piece theme) will use a different piece (and ID) assignment as HaChu used before for dropless Wa:

Image
Wa Shogi, with all black pieces promoted

This uses the pieceToCharTable

P..^S!^FS...W^OH.F.^R.^O'....R...D.GOO'^M..^H.M.C.^CC'.^W/.......^S.^P.^C'..^DS!.^GXKp..^s!^fs...w^oh.f.^r.^o'....r...d.goo'^m..^h.m.c.^cc'.^w/.......^s.^p.^c'..^ds!.^gxk

and FEN

hmo'cskwgc'do/1+o'3s!3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S!3+O'1/ODC'GWKSCO'MH w 0 1

where '^C' is the new method of defining a piece as '+' and at the same time pairing it with 'C'.

This might still run into a problem in Wa with drops, however: there is no piece E defined (for Cloud Eagle), and the primordial Cloud Eagle is indicated as +O' (promoted Swooping Owl). This causes the CE to demote on capture. Now arguably this is the better rule for Wa with drops, as a CE is way too strong for being dropped. (And the primordial Treacherous Fox (X) should similarly be replaced by +R (promoted Running Rabbit).) I am afraid this is not how people usually play it, though.

Would it be a problem to switch Sjaak II for using these new piece assignments when XBoard 4.9.0 will be released (which can be any moment now)? I will do the same in HaChu. Perhaps we should give it a new variant name to avoid confusion, and be able to keep supporting the old implementation for backward compatibility.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by Evert »

hgm wrote:Does the standard version of Sjaak II play Wa Shogi?
It's not pre-configured to, it seems, but I have the following definition laying around that may or may not implement the game correctly (I don't have time to check that between now and Wednesday):

Code: Select all

########## 
# WaShogi # 
########## 

Variant: WaShogi (11x11) 
Board: 11x11 
FEN: "hmocvkwgubd/1e3l3f1/ppprpppqppp/3p3p3/11/11/11/3P3P3/PPPQPPPRPPP/1E3L3F1/DBUGWKVCOMH w - 0 1" 
XBoard pieces:  "P.BRQFE.CWMOH..GDVL.U.+.++.+..+++++..+++.++Kp.brqfe.cwmoh..gdvl.u.+.++.+..+++++..+++.++k" 
XBoard parent:  "chu" 
Zone: white_promotion = a11,b11,c11,d11,e11,f11,g11,h11,i11,j11,k11,a10,b10,c10,d10,e10,f10,g10,h10,i10,j10,k10,a9,b9,c9,d9,e9,f9,g9,h9,i9,j9,k9
Zone: black_promotion = a3,b3,c3,d3,e3,f3,g3,h3,i3,j3,k3,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1 

# crane King, K=King 
# cloud Eagle, E=Alfil 
# flying Falcon F=Ferz promotes to *Tenacious Falcon 
# swaLLows wings, L=Lance promotes to *Gliding Swallow 
# Treacherous fox, Q=Queen 
# running Rabbit, R=Rook promotes to *Treacherous fox 
# violent Wolf, W=Wazir promotes to *Bear's Eyes 
# Violent stag, V=Falcon promotes to *Roaming Boar 
# flying Goose, G=Grasshopper promotes to *Swallow's Wings 
# flying Cock, C=Chancellor promotes to *Raiding Falcon 
# strUtting crow, U=Unicorn promotes to *Flying Falcon 
# swooping Owl, O=Cannon promotes to *Cloud Eagle 
# Blind dog, B=Bishop promotes to *Violent Wolf 
# climbing Monkey, M=Man promotes to *Violent Stag 
# liberated Horse, H=Nightrider promotes to  *Heavenly Horse 
# oXcart, D promotes to *Plodding Ox 
# sparrow Pawn, P=Pawn promotes to *Golden Bird 


# Define the pieces 

Piece: Crane King 
Move: leap (0,1)|(1,1) 
Symbol: "K", "K,k" 
Flags: royal 

Piece: Cloud Eagle 
Move: slide (V) 
Move: step W,E,SW,SE,3NW,3NE 
Symbol: "E", "E,e" 
Value: 850 

Piece: Treacherous Fox 
Symbol: "Q", "Q,q" 
Move: step NW,N,NE,SW,S,SE 
Move: leap (2,2)|(-2,2) 
Value: 750 

Piece: Sparrow Pawn 
Symbol: "P", "P,p" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 
#Flags: drop_no_mate, drop_one_file 
Value: 80 

Piece: Golden Bird 
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1) 
Symbol: "+P", "+P,+p" 
Value: 450 

Piece: Flying Falcon 
Symbol: "F", "F,f" 
Move: slide (D,A) 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 
Value: 600 

Piece: Tenacious Falcon 
Symbol: "+F", "+F,+f" 
Move: slide (V,A,D) 
Move: step W,E 
Value: 700 

Piece: Running Rabbit 
Symbol: "R", "R,r" 
Move: step 11N 
Move: step NE,NW,SE,S,SW 
Promotion: white_promotion, black_promotion, "+" 
Value: 400 

Piece: Promoted Running Rabbit 
Move: step NW,N,NE,SW,S,SE 
Move: leap (2,2)|(-2,2)|(-2,2)|(-2,-2) 
Symbol: "+R", "+R,+r" 
Value: 750 

Piece: Violent Wolf 
Symbol: "W", "W,w" 
# Move: step N 
Promotion: white_promotion, black_promotion, "+" 
Value: 400 

Piece: Bears Eyes 
Symbol: "+W", "+W,+w" 
Move: leap (0,1)|(1,1) 

Piece: Violent Stag 
Symbol: "V", "V,v" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Roaming Boar 
Symbol: "+V", "+V,+v" 
Move: step N 

Piece: Blind Dog 
Symbol: "B", "B,b" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Blind Dog 
Symbol "+B", "+B,+b" 
Move: step N 

Piece: Climbing Monkey 
Symbol: "M", "M,m" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Flying Monkey 
Symbol: "+M", "+M,+m" 
Move: step N 

Piece: Flying Goose 
Symbol: "G", "G,g" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Flying Goose 
Symbol: "+G", "+G,+g" 
Move: slide (H) 

Piece: Flying Cock 
Symbol: "C", "C,c" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Raiding Falcon 
Symbol: "+C", "+C,+c" 
Move: step N 

Piece: Swallows Wings 
Symbol: "L", "L,l" 
# Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Gliding Swallow 
Symbol: "+L", "+L,+l" 
Move: step N 

Piece: Strutting Crow 
Symbol: "U", "U,u" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Strutting Cow 
Symbol: "+U", "+U,+u" 
Move: slide (D,A) 
Move: step N 

Piece: Swooping Owl 
Symbol: "O", "O,o" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Cloud Eagle (Promoted Swooping Owl) 
Symbol: "+O", "+O,+o" 
Move: step N 

Piece: Liberated Horse 
Symbol: "H", "H,h" 
Move: step 10N,2S 
Promotion: white_promotion, black_promotion, "+" 

Piece: Heavenly Horse 
Symbol: "+H", "+H,+h" 
Move: aleap (1,2)|(-1,2)|(1,-2)|(-1,-2) 

Piece: Oxcart 
Symbol: "D", "D,d" 
Move: step 10N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Plodding Ox (Promoted Oxcart) 
Symbol: "+D", "+D,+d" 
Move: leap (0,1)|(1,1) 

#Rule: keep capture, allow drops 
Rule: repeat4 = draw 
Rule: perpetual4 = loss 
It may not have been included in the standard list because the (then) current version of XBoard couldn't play it.
Now that the number of piece types in XBoard has been extended from 44 to 66, and there is no fixed pairing of promoted and unpromoted types, it is possible to make a much more satisfactory assignment of pieces. So the 1-kanji-wa piece theme we are going to supply (as well as the Mnemonic-S piece theme) will use a different piece (and ID) assignment as HaChu used before for dropless Wa:

Image
Wa Shogi, with all black pieces promoted

This uses the pieceToCharTable

P..^S!^FS...W^OH.F.^R.^O'....R...D.GOO'^M..^H.M.C.^CC'.^W/.......^S.^P.^C'..^DS!.^GXKp..^s!^fs...w^oh.f.^r.^o'....r...d.goo'^m..^h.m.c.^cc'.^w/.......^s.^p.^c'..^ds!.^gxk

and FEN

hmo'cskwgc'do/1+o'3s!3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S!3+O'1/ODC'GWKSCO'MH w 0 1

where '^C' is the new method of defining a piece as '+' and at the same time pairing it with 'C'.
That may be something I need to make SjaakII aware of (perhaps not though, but it treats "+" in a special way), I'll need to double check that.
Not so much for the PieceToChar (which has no meaning for SjaakII), but for the purpose of handling FEN strings and encoding promotion moves.
I'll take a closer look when Wednesday roles by.
Would it be a problem to switch Sjaak II for using these new piece assignments when XBoard 4.9.0 will be released (which can be any moment now)? I will do the same in HaChu. Perhaps we should give it a new variant name to avoid confusion, and be able to keep supporting the old implementation for backward compatibility.
Updating it should be no problem (and there may be other variants that need updates; Grande Acedrex should be updated in Postduif as well), especially considering that it apparently doesn't come with it pre-configured.
It may in general be useful to have some way to define multiple sub-divisions of a particular variant that the user can switch between, but I'll need to think on how to support that elegantly. It would mainly be about how this is reported through the GUI, which I've mostly tried to stay away from. Anyway, with such a mechanism the user could switch between a "4.8" and a "4.9" definition.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by hgm »

Note that the Wa definition you post is only partly finished. (Half the pieces move as Pawn.)

If it was not included we won't have a problem with backward compatibility.

Note that '+' in FEN still has the same meaning, being the prefix of the piece ID when the piece is promoted. XBoard 4.9 has the new feature, though, that L' and L! are also valid IDs. This can appear in FEN and promotion suffixes.In the new Wa definition I used this for Strutting Crow (C'), Swooping Owl (O') and Swallow's Wings (S!), so that O remained available for Oxcart, C for Flying Cock and S for Violent Stag.

For Wa, with 17 unpromoted pieces and the + prefix to them for the promoted version, the shortge of letters is not so severe that this is really needed. You did a pretty good job assigning IDs with just pure letters. Limited to those I wouldprobably also go to V for the Stag and U for the Crow. And probaly use L for the Owl.

Perhaps I should do that anyway, and refrain from using any 'dressed letter' IDs when they are not absolutely needed.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by Evert »

hgm wrote:Note that the Wa definition you post is only partly finished. (Half the pieces move as Pawn.)

If it was not included we won't have a problem with backward compatibility.
I'm not actually sure it was mine to begin with; I think Keith White may have been working on it. I don't know if he ever finished it.
Anyway, I completed what I had to the following (most piece values are blank because I haven't a clue):

Code: Select all

########## 
# WaShogi # 
########## 

Variant: WaShogi (11x11) 
Board: 11x11 
FEN: "hmocvkwgubd/1e3l3f1/ppprpppqppp/3p3p3/11/11/11/3P3P3/PPPQPPPRPPP/1E3L3F1/DBUGWKVCOMH w - 0 1" 
XBoard pieces: "P.BRQFE.CWMOH..GDVL.U/+.++.+..+++++..+++.++Kp.brqfe.cwmoh..gdvl.u/+.++.+..+++++..+++.++k" 

#FEN: "hmocvkwgubd/1e3l3f1/ppprpppqppp/3p3p3/11/11/11/3P3P3/PPPQPPPRPPP/1E3L3F1/DBUGWKVCOMH w - 0 1" 
#FEN: "hmo'cskwgc'do/1+o'3s!3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S!3+O'1/ODC'GWKSCO'MH w 0 1"
#XBoard pieces: "P..^S!^FS...W^OH.F.^R.^O'....R...D.GOO'^M..^H.M.C.^CC'.^W/.......^S.^P.^C'..^DS!.^GXKp..^s!^fs...w^oh.f.^r.^o'....r...d.goo'^m..^h.m.c.^cc'.^w/.......^s.^p.^c'..^ds!.^gxk"

XBoard parent:  "chu" 
Zone: white_promotion = a11,b11,c11,d11,e11,f11,g11,h11,i11,j11,k11,a10,b10,c10,d10,e10,f10,g10,h10,i10,j10,k10,a9,b9,c9,d9,e9,f9,g9,h9,i9,j9,k9
Zone: black_promotion = a3,b3,c3,d3,e3,f3,g3,h3,i3,j3,k3,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1 

# crane King, K=King 
# cloud Eagle, E=Alfil 
# flying Falcon F=Ferz promotes to *Tenacious Falcon 
# swaLLows wings, L=Lance promotes to *Gliding Swallow 
# Treacherous fox, Q=Queen 
# running Rabbit, R=Rook promotes to *Treacherous fox 
# violent Wolf, W=Wazir promotes to *Bear's Eyes 
# Violent stag, V=Falcon promotes to *Roaming Boar 
# flying Goose, G=Grasshopper promotes to *Swallow's Wings 
# flying Cock, C=Chancellor promotes to *Raiding Falcon 
# strUtting crow, U=Unicorn promotes to *Flying Falcon 
# swooping Owl, O=Cannon promotes to *Cloud Eagle 
# Blind dog, B=Bishop promotes to *Violent Wolf 
# climbing Monkey, M=Man promotes to *Violent Stag 
# liberated Horse, H=Nightrider promotes to  *Heavenly Horse 
# oXcart, D promotes to *Plodding Ox 
# sparrow Pawn, P=Pawn promotes to *Golden Bird 


# Define the pieces 

Piece: Crane King 
Move: leap (0,1)|(1,1) 
Symbol: "K", "K,k" 
Flags: royal 

Piece: Cloud Eagle 
Move: slide (V) 
Move: step W,E,SW,SE,3NW,3NE 
Symbol: "E", "E,e" 
Value: 850 

Piece: Treacherous Fox 
Symbol: "Q", "Q,q" 
Move: aleap (1,1)|(2,2)|(-1,1)|(-2,2)|(1,-1)|(2,-2)|(-1,-1)|(-2,-2)|(0,1)|(0,2)|(0,-1)|(0,-2)
Value: 750 

Piece: Flying Falcon 
Symbol: "F", "F,f" 
Move: slide (D,A) 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 
Value: 600 

Piece: Tenacious Falcon 
Symbol: "+F", "+F,+f" 
Move: slide (V,A,D) 
Move: step W,E 
Value: 700 

Piece: Running Rabbit 
Symbol: "R", "R,r" 
Move: step NE,NW,SE,S,SW,10N
Promotion: white_promotion, black_promotion, "+" 
Value: 400 

Piece: Promoted Running Rabbit 
Move: aleap (1,1)|(2,2)|(-1,1)|(-2,2)|(1,-1)|(2,-2)|(-1,-1)|(-2,-2)|(0,1)|(0,2)|(0,-1)|(0,-2)
Symbol: "+R", "+R,+r" 
Value: 750 

Piece: Violent Wolf 
Symbol: "W", "W,w" 
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1)
Promotion: white_promotion, black_promotion, "+" 
Value: 400 

Piece: Bears Eyes 
Symbol: "+W", "+W,+w" 
Move: leap (0,1)|(1,1) 

Piece: Violent Stag 
Symbol: "V", "V,v" 
Move: aleap (0,1)|(1,1)|(1,-1)|(-1,-1)|(-1,1)
Promotion: white_promotion, black_promotion, "+" 

Piece: Roaming Boar 
Symbol: "+V", "+V,+v" 
Move: aleap (1,0)|(-1,0)|(0,1)|(1,1)|(-1,1)|(-1,-1)|(1,-1)

Piece: Blind Dog 
Symbol: "B", "B,b" 
Move: aleap (-1,1)|(1,1)|(-1,0)|(1,0)|(0,-1)
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Blind Dog 
Symbol: "+B", "+B,+b" 
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1)

Piece: Climbing Monkey 
Symbol: "M", "M,m" 
Move: aleap (-1,1)|(0,1)|(1,1)|(0,-1)
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Climbing Monkey 
Symbol: "+M", "+M,+m" 
Move: aleap (0,1)|(1,1)|(1,-1)|(-1,-1)|(-1,1)
Move: step N 

Piece: Flying Goose 
Symbol: "G", "G,g" 
Move: aleap (-1,1)|(0,1)|(1,1)|(0,-1)
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Flying Goose 
Symbol: "+G", "+G,+g" 
Move: slide (H) 
Move: step N,S

Piece: Flying Cock 
Symbol: "C", "C,c" 
Move: aleap (-1,1)|(-1,0)|(1,1)|(1,0)
Promotion: white_promotion, black_promotion, "+" 

Piece: Raiding Falcon 
Symbol: "+C", "+C,+c" 
Move: aleap (-1,1)|(-1,0)|(1,1)|(1,0)
Move: slide (V)

Piece: Swallows Wings 
Symbol: "L", "L,l" 
Move: slide (H) 
Move: step N,S
Promotion: white_promotion, black_promotion, "+" 

Piece: Gliding Swallow 
Symbol: "+L", "+L,+l" 
Move: slide (H,V)

Piece: Strutting Crow 
Symbol: "U", "U,u" 
Move: aleap (-1,-1)|(1,-1)|(0,1)
Promotion: white_promotion, black_promotion, "+" 

Piece: Promoted Strutting Cow 
Symbol: "+U", "+U,+u" 
Move: slide (D,A) 
Move: step N 

Piece: Swooping Owl 
Symbol: "O", "O,o" 
Move: aleap (-1,-1)|(1,-1)|(0,1)
Promotion: white_promotion, black_promotion, "+" 

Piece: Cloud Eagle (Promoted Swooping Owl) 
Symbol: "+O", "+O,+o" 
Move: slide (V) 
Move: step W,E,SW,SE,3NW,3NE 

Piece: Liberated Horse 
Symbol: "H", "H,h" 
Move: step 10N,2S 
Promotion: white_promotion, black_promotion, "+" 

Piece: Heavenly Horse 
Symbol: "+H", "+H,+h" 
Move: aleap (1,2)|(-1,2)|(1,-2)|(-1,-2) 

Piece: Oxcart 
Symbol: "D", "D,d" 
Move: step 10N 
Promotion: white_promotion, black_promotion, "+" 

Piece: Plodding Ox (Promoted Oxcart) 
Symbol: "+D", "+D,+d" 
Move: leap (0,1)|(1,1) 

Piece: Sparrow Pawn 
Symbol: "P", "P,p" 
Move: step N 
Promotion: white_promotion, black_promotion, "+" 
Flags: drop_no_mate, drop_one_file 
Value: 80 

Piece: Golden Bird (Promoted Sparrow Pawn)
Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1) 
Symbol: "+P", "+P,+p" 
Value: 450 

Rule: keep capture, allow drops 
Rule: repeat4 = draw 
Rule: perpetual4 = loss 
This seems to work, for the most part, but games typically end with an "Illegal move" claim from XBoard when promoting a Running Rabbit. I'm not sure why yet.
Note that '+' in FEN still has the same meaning, being the prefix of the piece ID when the piece is promoted. XBoard 4.9 has the new feature, though, that L' and L! are also valid IDs. This can appear in FEN and promotion suffixes.In the new Wa definition I used this for Strutting Crow (C'), Swooping Owl (O') and Swallow's Wings (S!), so that O remained available for Oxcart, C for Flying Cock and S for Violent Stag.
Ok, in that case SjaakII wouldn't require any changes or updates.
For Wa, with 17 unpromoted pieces and the + prefix to them for the promoted version, the shortge of letters is not so severe that this is really needed. You did a pretty good job assigning IDs with just pure letters. Limited to those I wouldprobably also go to V for the Stag and U for the Crow. And probaly use L for the Owl.

Perhaps I should do that anyway, and refrain from using any 'dressed letter' IDs when they are not absolutely needed.
Let me know if you've settled on a final assignment and I'll update the variant definition. It requires renaming the pieces, which is easy but tedious (especially considering that I haven't actually got a clue what is what when looking at the board) so I'd rather not do it until I have to. ;)
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by hgm »

Evert wrote:This seems to work, for the most part, but games typically end with an "Illegal move" claim from XBoard when promoting a Running Rabbit. I'm not sure why yet.
Are other promotions OK, or is this merely because the Rabbit is usually the first piece to promote? When I play with the @wa definition in -ncp mode it gives no problems to promote the R, and ^R seems to be in the pieceToCharTable. Chu as parent should be fine. (The conf file I made for Wa used elven as parent, but this was a bad idea, as it has other conventions for notation of promotions as Shogi. But when I first wrote that definition I was still juggling piece images in variant chu, so that the order in the pieceToCharTable was not the normal one. I now patched that in XBoard.)
Let me know if you've settled on a final assignment and I'll update the variant definition. It requires renaming the pieces, which is easy but tedious (especially considering that I haven't actually got a clue what is what when looking at the board) so I'd rather not do it until I have to. ;)
Will do.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by Evert »

hgm wrote: Are other promotions OK, or is this merely because the Rabbit is usually the first piece to promote? When I play with the @wa definition in -ncp mode it gives no problems to promote the R, and ^R seems to be in the pieceToCharTable. Chu as parent should be fine. (The conf file I made for Wa used elven as parent, but this was a bad idea, as it has other conventions for notation of promotions as Shogi. But when I first wrote that definition I was still juggling piece images in variant chu, so that the order in the pieceToCharTable was not the normal one. I now patched that in XBoard.)
It's possible that there is an issue with the version of XBoard I have. It's from after the piece images were re-ordered; I think it's from when the help-system was just being revised.

The initial problem I had was due to making a different assumption about the number of characters in the pieceToChar string, but that's fixed with the current version. It doesn't only happen with the Rabbit though, but it does seem to happen on all promotions:

Code: Select all

[Event "Computer Chess Game"]
[Site "vivaine.local"]
[Date "2016.04.27"]
[Round "1"]
[White "Sjaak II 583:584M"]
[Black "Sjaak II 583:584M"]
[Result "0-1"]
[TimeControl "40/10"]
[Variant "washogi"]
[FEN "hmocvkwgubd/1e3l3f1/ppprpppqppp/3p3p3/11/11/11/3P3P3/PPPQPPPRPPP/1E3L3F1/DBUGWKVCOMH[-] w - 0 1"]
[SetUp "1"]

{--------------
h m o c v k w g u b d
. e . . . l . . . f .
p p p r p p p q p p p
. . . p . . . p . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . P . . . P . . .
P P P Q P P P R P P P
. E . . . L . . . F .
D B U G W K V C O M H
white to play
--------------}
1. Rg4 {-0.22/5} Wg10 {+0.50/5 0.2} 2. Qf5 {-0.42/6 0.3} Re8 {+0.44/5 0.2}
3. Ke2 {-0.43/5 0.2} Rf7 {+0.37/6 0.2} 4. Qe4 {-0.72/6 0.2} Ec10
{+0.51/5 0.2} 5. j4 {-0.36/5 0.2} Ee8 {+0.60/5 0.3} 6. Fj3 {-0.63/4 0.1}
Ee7 {+0.60/6 0.2} 7. Rf5 {-0.70/6 0.3} Rxf5 {+0.63/6 0.3} 8. Qxf5
{+0.16/5 0.3} R@f8 {+0.60/5 0.2} 9. R@e4 {-0.90/4 0.2} Exh4 {+1.05/5 0.2}
{Xboard: Forfeit due to invalid move: j3b11+ (_1_1 via ^0, ^0) res=25} 0-1
And the relevant part of the debug file:

Code: Select all

5002 >first : e7h4
5126 <first &#58; # Begin iterative deepening loop for position "hmocvk1gubd/5lw2f1/ppp1pppqppp/3p1r1p3/11/11/5Q5/3PR2e1P1/PPP1PPP1PFP/1E2KL5/DBUGW1VCOMH&#91;p&#93; w 0 10"
5126 <first &#58;   2   -90      0      1576  10. Qg4 Mc10
5126 <first &#58;   3   -88      2      3960  10. Qg4 Mc10 11. Mj2
5126 <first &#58;   4  -105      9     12734  10. Fxb11+ Rxf5 11. Rxf5 Exh1
5126 <first &#58;   5   -83     10     13354  10. Fxb11+!
5127 <first &#58;   5   -62     11     14536  10. Fxb11+!
5170 <first &#58;   5   -83     16     20884  10. Fxb11+ Rxf5 11. Rxf5 Exh1 12. Vh2
5170 <first &#58; move j3b11+
Impossible move j3b;+, type = 25
GameEnds&#40;27, Xboard&#58; Forfeit due to invalid move&#58; j3b11+ (_1_1 via ^0, ^0&#41; res=25, 4&#41;
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by hgm »

It is not clear to me which pieceToChar string you are using. XBoard shows a diagram with U for the Crow in it in the PGN, but the new one I defined does have C' for Crow, while U does not appear. So you cannot be using the new one. And the format of the old one is not valid anymore, as it supposes implicit pairing in variant Chu between the first 22 pieces and the second 22 (behind the slash). While in XBoard 4.9 there only is implied pairing between the first 11 and second 11, (in any variant, also Chu; the default pieceToCharTable for Chu specifies the actual pairings, which are different than in 4.8 because of the re-ordering), while the others are not paired. And the slash now skips to piece #46 rather than #22.

So with the old pieceToChar most pieces would have implied pairing with a piece defined as '.', or would be paired with something other than a '+', with as a result that XBoard considers them non-promoting.

In the mean time I have decided it would be better not to use dressed letters unless it would get too crazy without them. For Wa, which needs 17 letters, the normal alphabet still suffices, even if there are a few less-elegant IDs. I don't like some of the IDs Sjaak used above, though: 'D' for 'Oxcart' makes no sense, and I used it for 'Blind Dog', because in general it is better to abbreviate the noun than the adjective. U for Strutting Crow is good enough. It is a pity that 'S' for Violent Stag collides with 'Swallow's Wings', as the Stag moves as Silver. OTOH using V for it while the Gold is 'W' (for 'Wolf') has some logic to it too. The collision between Oxcart and Owl can be solved by using 'L' for the latter. That makes the worst IDs 'U' for Strutting Crow and 'L' for Swooping Owl, (and 'X' for Fox) while all others use the first letter of one words in their name, and except for one case that would be a noun. That seems bearable.

So this will be the final assignment:

-pieceToCharTable "P..^S^FV..^LW^OH.F.^R.E....R...D.GOL^M..^H.M.C.^CU.^W/.......^V.^P.^U..^DS.^GXKp..^s^fv..^lw^oh.f.^r.e....r...d.gol^m..^h.m.c.^cu.^w/.......^v.^p.^u..^ds.^gxk"

-fen "hmlcvkwgudo/1e3s3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S3E1/ODUGWKVCLMH w"


O Oxcart
D Blind Dog
U Strutting Crow
G Flying Goose
W Violent Wolf
K Crane King
V Violent Stag
C Flying Cock
L Swooping Owl
M Climbing Monkey
H Liberated Horse
F Flying Falcon
S Swallow's Wings
E Cloud Eagle
X Treacherous Fox (seems better than the T, which would also be available)
R Running Rabbit
P Sparrow Pawn
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by hgm »

HaChu (from the winboard.nl repository) should now play dropless Wa in XBoard 4.9 with the indicated piece IDs and image assignment. It uses the name wa-shogi.

Note that your definition still has an e and f piece swapped in the FEN.

Btw, would O for the Owl, T for the Fox and X for the Oxcart be better as what I had above?
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by Evert »

I had been using this PieceToChar, which is basically the old one I had but with the / to skip to the promotion series: "P.BRQFE.CWMOH..GDVL.U/+.++.+..+++++..+++.++Kp.brqfe.cwmoh..gdvl.u/+.++.+..+++++..+++.++k"

However, I now switched to this game definition based on your piece assignments:

Code: Select all

########## 
# WaShogi # 
########## 

Variant&#58; WaShogi &#40;11x11&#41; 
Board&#58; 11x11 
#FEN&#58; "hmocvkwgubd/1e3l3f1/ppprpppqppp/3p3p3/11/11/11/3P3P3/PPPQPPPRPPP/1E3L3F1/DBUGWKVCOMH w - 0 1" 
#XBoard pieces&#58; "P.BRQFE.CWMOH..GDVL.U/+.++.+..+++++..+++.++Kp.brqfe.cwmoh..gdvl.u/+.++.+..+++++..+++.++k" 

FEN&#58; "hmlcvkwgudo/1e3s3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S3E1/ODUGWKVCLMH w 0 1"
XBoard pieces&#58; "P..^S^FV..^LW^OH.F.^R.E....R...D.GOL^M..^H.M.C.^CU.^W/.......^V.^P.^U..^DS.^GXKp..^s^fv..^lw^oh.f.^r.e....r...d.gol^m..^h.m.c.^cu.^w/.......^v.^p.^u..^ds.^gxk"

XBoard parent&#58;  "chu" 
Zone&#58; white_promotion = a11,b11,c11,d11,e11,f11,g11,h11,i11,j11,k11,a10,b10,c10,d10,e10,f10,g10,h10,i10,j10,k10,a9,b9,c9,d9,e9,f9,g9,h9,i9,j9,k9
Zone&#58; black_promotion = a3,b3,c3,d3,e3,f3,g3,h3,i3,j3,k3,a2,b2,c2,d2,e2,f2,g2,h2,i2,j2,k2,a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1 

# crane King, K=King 
# cloud Eagle, E
# flying Falcon F promotes to *Tenacious Falcon 
# Swallows wings, S promotes to *Gliding Swallow 
# treacherous foX, X
# running Rabbit, R promotes to *Treacherous fox 
# violent Wolf, W promotes to *Bear's Eyes 
# Violent stag, V promotes to *Roaming Boar 
# flying Goose, G promotes to *Swallow's Wings 
# flying Cock, C promotes to *Raiding Falcon 
# strUtting crow, U promotes to *Flying Falcon 
# swooping owL, L promotes to *Cloud Eagle 
# blind Dog, D promotes to *Violent Wolf 
# climbing Monkey, M promotes to *Violent Stag 
# liberated Horse, H promotes to  *Heavenly Horse 
# Oxcart, O promotes to *Plodding Ox 
# sparrow Pawn, P=Pawn promotes to *Golden Bird 


# Define the pieces 

Piece&#58; Crane King 
Symbol&#58; "K", "K,k" 
Move&#58; leap &#40;0,1&#41;|&#40;1,1&#41; 
Flags&#58; royal 

Piece&#58; Cloud Eagle 
Symbol&#58; "E", "E,e" 
Move&#58; slide &#40;V&#41; 
Move&#58; step W,E,SW,SE,3NW,3NE 
Value&#58; 850 

Piece&#58; Treacherous Fox 
Symbol&#58; "X", "X,x" 
Move&#58; aleap &#40;1,1&#41;|&#40;2,2&#41;|(-1,1&#41;|(-2,2&#41;|&#40;1,-1&#41;|&#40;2,-2&#41;|(-1,-1&#41;|(-2,-2&#41;|&#40;0,1&#41;|&#40;0,2&#41;|&#40;0,-1&#41;|&#40;0,-2&#41;
Value&#58; 750 

Piece&#58; Flying Falcon 
Symbol&#58; "F", "F,f" 
Move&#58; slide &#40;D,A&#41; 
Move&#58; step N 
Promotion&#58; white_promotion, black_promotion, "+" 
Value&#58; 600 

Piece&#58; Tenacious Falcon 
Symbol&#58; "+F", "+F,+f" 
Move&#58; slide &#40;V,A,D&#41; 
Move&#58; step W,E 
Value&#58; 700 

Piece&#58; Running Rabbit 
Symbol&#58; "R", "R,r" 
Move&#58; step NE,NW,SE,S,SW,10N
Promotion&#58; white_promotion, black_promotion, "+" 
Value&#58; 400 

Piece&#58; Promoted Running Rabbit 
Symbol&#58; "+R", "+R,+r" 
Move&#58; aleap &#40;1,1&#41;|&#40;2,2&#41;|(-1,1&#41;|(-2,2&#41;|&#40;1,-1&#41;|&#40;2,-2&#41;|(-1,-1&#41;|(-2,-2&#41;|&#40;0,1&#41;|&#40;0,2&#41;|&#40;0,-1&#41;|&#40;0,-2&#41;
Value&#58; 750 

Piece&#58; Violent Wolf 
Symbol&#58; "W", "W,w" 
Move&#58; aleap &#40;1,0&#41;|(-1,0&#41;|&#40;0,1&#41;|&#40;0,-1&#41;|&#40;1,1&#41;|(-1,1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 
Value&#58; 400 

Piece&#58; Bears Eyes 
Symbol&#58; "+W", "+W,+w" 
Move&#58; leap &#40;0,1&#41;|&#40;1,1&#41; 

Piece&#58; Violent Stag 
Symbol&#58; "V", "V,v" 
Move&#58; aleap &#40;0,1&#41;|&#40;1,1&#41;|&#40;1,-1&#41;|(-1,-1&#41;|(-1,1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Roaming Boar 
Symbol&#58; "+V", "+V,+v" 
Move&#58; aleap &#40;1,0&#41;|(-1,0&#41;|&#40;0,1&#41;|&#40;1,1&#41;|(-1,1&#41;|(-1,-1&#41;|&#40;1,-1&#41;

Piece&#58; Blind Dog 
Symbol&#58; "D", "D,d" 
Move&#58; aleap (-1,1&#41;|&#40;1,1&#41;|(-1,0&#41;|&#40;1,0&#41;|&#40;0,-1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Promoted Blind Dog 
Symbol&#58; "+D", "+D,+d" 
Move&#58; aleap &#40;1,0&#41;|(-1,0&#41;|&#40;0,1&#41;|&#40;0,-1&#41;|&#40;1,1&#41;|(-1,1&#41;

Piece&#58; Climbing Monkey 
Symbol&#58; "M", "M,m" 
Move&#58; aleap (-1,1&#41;|&#40;0,1&#41;|&#40;1,1&#41;|&#40;0,-1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Promoted Climbing Monkey 
Symbol&#58; "+M", "+M,+m" 
Move&#58; aleap &#40;0,1&#41;|&#40;1,1&#41;|&#40;1,-1&#41;|(-1,-1&#41;|(-1,1&#41;

Piece&#58; Flying Goose 
Symbol&#58; "G", "G,g" 
Move&#58; aleap (-1,1&#41;|&#40;0,1&#41;|&#40;1,1&#41;|&#40;0,-1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Promoted Flying Goose 
Symbol&#58; "+G", "+G,+g" 
Move&#58; slide &#40;H&#41; 
Move&#58; aleap &#40;0,1&#41;|&#40;0,-1&#41;

Piece&#58; Flying Cock 
Symbol&#58; "C", "C,c" 
Move&#58; aleap (-1,1&#41;|(-1,0&#41;|&#40;1,1&#41;|&#40;1,0&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Raiding Falcon 
Symbol&#58; "+C", "+C,+c" 
Move&#58; aleap (-1,1&#41;|(-1,0&#41;|&#40;1,1&#41;|&#40;1,0&#41;
Move&#58; slide &#40;V&#41;

Piece&#58; Swallows Wings 
Symbol&#58; "S", "S,s" 
Move&#58; slide &#40;H&#41; 
Move&#58; aleap &#40;0,1&#41;|&#40;0,-1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Gliding Swallow 
Symbol&#58; "+S", "+S,+s" 
Move&#58; slide &#40;H,V&#41;

Piece&#58; Strutting Crow 
Symbol&#58; "U", "U,u" 
Move&#58; aleap (-1,-1&#41;|&#40;1,-1&#41;|&#40;0,1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Promoted Strutting Cow 
Symbol&#58; "+U", "+U,+u" 
Move&#58; slide &#40;D,A&#41; 
Move&#58; step N 

Piece&#58; Swooping Owl 
Symbol&#58; "L", "L,l" 
Move&#58; aleap (-1,-1&#41;|&#40;1,-1&#41;|&#40;0,1&#41;
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Cloud Eagle &#40;Promoted Swooping Owl&#41; 
Symbol&#58; "+L", "+L,+l" 
Move&#58; slide &#40;V&#41; 
Move&#58; step W,E,SW,SE,3NW,3NE 

Piece&#58; Liberated Horse 
Symbol&#58; "H", "H,h" 
Move&#58; step 10N,2S 
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Heavenly Horse 
Symbol&#58; "+H", "+H,+h" 
Move&#58; aleap &#40;1,2&#41;|(-1,2&#41;|&#40;1,-2&#41;|(-1,-2&#41; 

Piece&#58; Oxcart 
Symbol&#58; "O", "O,o" 
Move&#58; step 10N 
Promotion&#58; white_promotion, black_promotion, "+" 

Piece&#58; Plodding Ox &#40;Promoted Oxcart&#41; 
Symbol&#58; "+O", "+O,+o" 
Move&#58; leap &#40;0,1&#41;|&#40;1,1&#41; 

Piece&#58; Sparrow Pawn 
Symbol&#58; "P", "P,p" 
Move&#58; step N
Promotion&#58; white_promotion, black_promotion, "+" 
Flags&#58; drop_no_mate, drop_one_file 
Value&#58; 80 

Piece&#58; Golden Bird &#40;Promoted Sparrow Pawn&#41;
Symbol&#58; "+P", "+P,+p" 
Move&#58; aleap &#40;1,0&#41;|(-1,0&#41;|&#40;0,1&#41;|&#40;0,-1&#41;|&#40;1,1&#41;|(-1,1&#41; 
Value&#58; 450 

Rule&#58; keep capture, allow drops 
Rule&#58; repeat4 = draw 
Rule&#58; perpetual4 = loss 
However, this results in a segfault from XBoard when I try to start the game (I updated to the latest from your git repository):

Code: Select all

xboard&#40;87723,0x7fff78394180&#41; malloc&#58; *** error for object 0x2e2e2e2e2e2e2e2e&#58; pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap&#58; 6 &#40;core dumped&#41;
With (probably unhelpful) backtrace

Code: Select all

#0  0x00007fff88897212 in __pthread_kill ()
#1  0x00007fff8a750b24 in pthread_kill ()
#2  0x00007fff8a794f61 in abort ()
#3  0x00007fff8a768989 in free ()
#4  0x0000000109c6afa5 in HandleMachineMove ()
#5  0x0000000109c91942 in ReceiveFromProgram ()
#6  0x0000000109ceedb0 in DoInputCallback ()
#7  0x000000010aaf681c in g_main_context_dispatch ()
#8  0x000000010aaf6add in g_main_context_iterate ()
#9  0x000000010aaf6b35 in g_main_context_iteration ()
#10 0x000000010a065d74 in gtk_main_iteration ()
#11 0x0000000109cec3fe in main ()
The logfile contains

Code: Select all

854 <first &#58; setup &#40;P..^S^FV..^LW^OH.F.^R.E....R...D.GOL^M..^H.M.C.^CU.^W/.......^V.^P.^U..^DS.^GXKp..^s^fv..^lw^oh.f.^r.e....r...d.gol^m..^h.m.c.^cu.^w/.......^v.^p.^u..^ds.^gxk&#41; 11x11+16_chu hmlcvkwgudo/1e3s3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S3E1/ODUGWKVCLMH w 0 1
recognized 'chu' (-1&#41; as variant washogi
shuffleOpenings = 0
953 <first &#58; piece K& K
953 <first &#58; piece E& vRfF3sWbF
953 <first &#58; piece X& FAvWvD
953 <first &#58; piece F& BfW
954 <first &#58; piece +F& BvRsW
while the full setup that is sent is

Code: Select all

setup &#40;P..^S^FV..^LW^OH.F.^R.E....R...D.GOL^M..^H.M.C.^CU.^W/.......^V.^P.^U..^DS.^GXKp..^s^fv..^lw^oh.f.^r.e....r...d.gol^m..^h.m.c.^cu.^w/.......^v.^p.^u..^ds.^gxk&#41; 11x11+16_chu hmlcvkwgudo/1e3s3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S3E1/ODUGWKVCLMH w 0 1
piece K& K
piece E& vRfF3sWbF
piece X& FAvWvD
piece F& BfW
piece +F& BvRsW
piece R& fRbWF
piece +R& FAvWvD
piece W& WfF
piece +W& K
piece V& FfW
piece +V& FsfW
piece D& sbWfF
piece +D& WfF
piece M& vWfF
piece +M& FfW
piece G& vWfF
piece +G& sRvW
piece C& sWfF
piece +C& vRsWfF
piece S& sRvW
piece +S& R
piece U& bFfW
piece +U& BfW
piece L& bFfW
piece +L& vRfF3sWbF
piece H& fRbW2
piece +H& ffbbN
piece O& fR@10
piece +O& K
piece P& fWf@10
piece +P& WfF
Disabling the sending of piece commands in SjaakII avoids the crash (but the game cannot be played, even with legality testing off), so it apparently crashes on either of these:

Code: Select all

piece +F& BvRsW
piece R& fRbWF
Oddly, this did not happen with the earlier definition...
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Sjaak II, Wa Shogi and XBoard 4.9

Post by Evert »

hgm wrote:HaChu (from the winboard.nl repository) should now play dropless Wa in XBoard 4.9 with the indicated piece IDs and image assignment. It uses the name wa-shogi.
Apparently I cannot use a "-" in the name of a variant in SjaakII. Something I'll need to fix (you can always set the alias "wa-shogi=washogi" in SjaakII's engine options to work around the name clash).
Is that repository a different one from http://hgm.nubati.net/cgi-bin/gitweb.cgi ?
Note that your definition still has an e and f piece swapped in the FEN.
Ok, I never checked the FEN. I copied yours now, so it should match.
Btw, would O for the Owl, T for the Fox and X for the Oxcart be better as what I had above?
Hmm... maybe.
I find it hard to begin with the associate the pieces with their names, but it does seem somewhat natural (although "x" for "foX" does seem better normally).

By the way - can this be played in XBoard with drops, or do you run into issues with the way the holdings are set up?