WB support for new variant (cannon chess)

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

Moderators: hgm, Andres Valverde

WB support for new variant (cannon chess)

Postby iqp » 03 Feb 2015, 13:35

Hi,

I came up with the idea to replace the queen in International Chess with the cannon from Xiangqi. I played around with it on a real board to see if it works, and was pleasantly surprised - there are some interesting aspects, such as 1.d4 being a blunder! The next step for me was to try to get Fairy-Max to play this variant; so I added the following to my fmax.ini:

Code: Select all
// Chess with queen replaced by cannon from Xiangqi
Game: cannon
8x8
8 5 6 9 3 6 5 8
8 5 6 9 4 6 5 8
p:74 -16,24 -16,6 -15,5 -17,5
p:74  16,24 16,6 15,5 17,5
k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
b:296 15,3 17,3 -15,3 -17,3
R:444 1,3 16,3 -1,3 -16,3
T:444 1,3 16,3 -1,3 -16,3
C:380 1,BA 16,BA -1,BA -16,BA


Now I can play Cannon Chess against Fairy-Max at the command-line, but ideally I'd like to use WinBoard as my interface. Unfortunately, although, cannon appears in the list of available variants, when I select "New Variant" I receive the error Engine did not send setup for non-standard variant. I'm not sure exactly what that means, but am guessing that WinBoard contains a hard-coded list of supported variants; because cannon isn't in that list, it requires the engine to send some sort of "setup" command?

Please could someone help me to get WinBoard working with Cannon Chess, as defined above?

Cheers,
Ralph
iqp
 
Posts: 11
Joined: 06 Oct 2014, 00:18
Location: South Africa

Re: WB support for new variant (cannon chess)

Postby H.G.Muller » 03 Feb 2015, 16:36

iqp wrote: but am guessing that WinBoard contains a hard-coded list of supported variants; because cannon isn't in that list, it requires the engine to send some sort of "setup" command?

Exactly!

To make Fairy-Max send such a setup command you have to define a 'pieceToCharTable', which maps the piece names (like C) to the WinBoard piece images, and you would have to specify a 'parent variant', which must be one of the standard variants (from which WinBoard then takes the other rules, e.g. whether stalemate is a win or a draw, whether capture is mandatory etc.). Like:

Game: cannon # PNBR.......CKpnbr.......ck # fairy

which would define C as the Cannon image, and use 'fairy' as parent variant (which has normal, Chess-like rules, without any frills). Fairy-Max then generates the startup FEN from the defined initial position by itself.

And you should define the corner piece as nr 7 in the initial setup, to prevent that Fairy-Max will send a setup FEN with T in it, which WinBoard would not understand. (I used a dirty trick with an 'S' duplicate of the Queen there, to get the pieces it uses in the middle game in ascending order of value, which makes quiescence search a bit more efficient. But this can only be used when you do not send a setup command.)
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: WB support for new variant (cannon chess)

Postby iqp » 03 Feb 2015, 18:50

Thank you so much Mr Muller, that worked perfectly!

Below is the fmax.ini entry for anyone who's interested in trying out Cannon Chess:

Code: Select all
// Chess with queen replaced by cannon from Xiangqi
Game: cannon # PNBR.......CKpnbr.......ck # fairy
8x8
7 5 6 8 3 6 5 7
7 5 6 8 4 6 5 7
p:74 -16,24 -16,6 -15,5 -17,5
p:74  16,24 16,6 15,5 17,5
k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
k:-1  1,34 -1,34 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
n:259 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
b:296 15,3 17,3 -15,3 -17,3
R:444 1,3 16,3 -1,3 -16,3
C:380 1,BA 16,BA -1,BA -16,BA
iqp
 
Posts: 11
Joined: 06 Oct 2014, 00:18
Location: South Africa


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 12 guests