Engine development to play a chess variant

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engine development to play a chess variant

Post by Ferdy »

hgm wrote: If you want to use L for Leopard and C for Cannon you would have to redefine the pieceToCharTable. Then you can also assign different images to them. The engine could do this in the setup command it sends in reply to 'variant musketeer':
PNBRQ......C.........LKpnbrq......c.........lk
I got the Leopard and Cannon now. Cool.

Image


Also implemented the capture evasion gate move.

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

Re: Engine development to play a chess variant

Post by Evert »

musketeerchess wrote: Gating the new pieces is really very simple.
Simple or not, it's still different from Seirawan, which is going to confuse people who already know that variant. The rules feel like they are different for the sake of being different, which is usually not a good thing...
In case of check rules are very simple also: if the king is checked and cannot either take the checking piece or protect it self and is obliged to move to escape from the check, than it forfeits the right to introduce the new piece.
I don't know if this is very simple: I'm not sure I understand what you're saying. If the king is in check and forced to move, it loses the right to gate a piece (ie, you cannot gate a piece when doing a check evasion), unless the evasion is a capture?
Choosing the initial placement of the new pieces fixes the rules and permits each army to think about a strategy. This also allows the enemy to seek for combinations (including checks or exchanging a virgin piece) sothat it wins an exchange and hampers the opponent from introducing a new piece.
Have you play-tested this? Not fixing the location where pieces can be gated immediately at the start of the game seems like it enhances the strategy by giving the player more options.
There is a chess variant "knight-in-the-pocket" where you start with an extra knight in-hand, that you can drop on an empty square later. It has a very interesting dynamic, but it feels less cramped than Seirawan, where the requirement to gate the pieces before you develop all your pieces limits you.
I assume that the rules are maybe difficult to program for an engine, but it's the rule.
They're not difficult, per se - but they're too specific for me to implement in SjaakII without modifications to the engine.
In case you don't know - SjaakII is my general variant engine, it can be configured by the user to play a large number of different chess variants, from regular chess to Shogi, Xiangqi, Seirawan or something in between. With Seirawan gating rules it would be able to play this game without modification (with the exception of the Fortress, SjaakII can't handle multi-leg moves). Adding the necessary extra rules for just this variant would be annoying - especially if it slows things down for other variants (SjaakII is already quite slow).
I think the game is beautiful as it is. Giving the new pieces a conventional manner to introduce them on the board respects the global spirit of order in chess. In classic chess there is no room for gambling the rules are clear, the initial placement of the pieces is also clear. Adding two new pieces is already much disturbing that's why i think that the rules as they are stated are the best way to deal with this specific problem.
Well, I disagree, but it's your game.
Adding new pieces is not a radical departure from orthodox chess, it's been done in numerous ways in different variants. Introducing them Seirawan-style doesn't change any of the aspects of the game you mention.

Let me put it this way: I actually find Seirawan gating rules to be rather clunky and cumbersome, this feels more stifling. An issue I have with Seirawan Chess is that the "new" pieces it has are rather strong and not particularly interesting. Some of the ones you included here are, I think, more interesting, so it fixes one issue I have with S-Chess at the cost of complicating another...
I also respect all your comments. This certainly will give plenty of other possibilities for creating derivative variants from musketeer chess.

Imagination imagination, all is about imagination
Sure, and I for one welcome any initiative to get more people interested in chess variants!
Roger Brown
Posts: 782
Joined: Wed Mar 08, 2006 9:22 pm

Re: Engine development to play a chess variant

Post by Roger Brown »

Evert wrote: Sure, and I for one welcome any initiative to get more people interested in chess variants!

Hello Evert,

Let us say that I am of average intelligence and reasonably motivated.

No snickers please...

What would you suggest as a chess variant for personal (human v machine) play? I would ask H.G. but whenever he discusses variants, my eyes glaze over and he will impatiently realise that I am hopeless.

Between FaryMax and your engine Sjaak, I should be able to find a variant which would be rewarding to learn.

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

Re: Engine development to play a chess variant

Post by Evert »

Roger Brown wrote: Hello Evert,

Let us say that I am of average intelligence and reasonably motivated.

No snickers please...

What would you suggest as a chess variant for personal (human v machine) play? I would ask H.G. but whenever he discusses variants, my eyes glaze over and he will impatiently realise that I am hopeless.

Between FaryMax and your engine Sjaak, I should be able to find a variant which would be rewarding to learn.

Later.
I had a long and detailed reply, but Safari just ate it. Perhaps the too long/didn't read version is better anyway:

I would probably recommend Pocket Knight, Capablanca/Gothic Chess, or Goro-Goro Shogi, in order of decreasing similarity to orthodox chess.

Pocket Knight only has familiar pieces, with one extra element compared to orthodox chess: an extra knight, to be dropped on the board on your move at will.

Capablanca/Gothic (they're the same really, except for the starting position) adds new pieces (the rook/knight and knight/bishop compounds) on a larger board (10x8). The same pieces are in Seirawan Chess, but I feel that the 8x8 board is too small to comfortably handle three queen-class pieces.

Goro-goro Shogi mostly has unfamiliar pieces, but they're all easy (they move to adjacent squares) and has drops, which add a very interesting dynamic to the game. The rules are easy to pick up, my almost-five year old was able to learn them quickly (albeit with a special for-children piece set), which means you're not bogged down with trying to remember all the rules, which is a problem with some other variants.

I'll put some more thoughts below, but feel free to stop reading here. If there's something I missed I'll follow up later.

There are some other variants that seem to be popular (in the sense that they're more commonly known) like Knightmate or Berolina Chess. Personally I think these are too gimmicky to be really interesting to play. Something like Fischer/Chess960 also counts as a variant, of course, but again it's not one that I think is particularly interesting. It seems to me more designed as a way to revitalise a waning interest in orthodox chess than as a game that is interesting in its own right. There's also Crazyhouse. Troitzky Chess is based on the idea that by making a small change to the chess board, KNNK becomes a forced win, which is neat but I'm not sure it makes the game particularly interesting. Legan's Chess effectively rotates the board by 45 degrees.

Although I think it's a really neat game, I would not recommend Spartan Chess as a first excursion in chess variant territory: you really need to learn the moves of six new piece types, and while none of them are hard I find it's a lot to take in. Definitely one of the better variants though.

Personally I have a weak spot for historical and regional variants, things like Shatranj, Courier, Makruk, Sittuyin, Shatar, Xiangqi and Shogi. Some of these games are quite slow though (Shatranj in particular). I think Xiangqi was the first chess variant I learned to play (apart from things like suicide/atomic/bughouse as a kid).

You could always just look at some of the games I listed and seeing if there is something that peeks your interest. A word of warning when playing any of these against a computer though: for many of the games, the computer is not very strong (neither SjaakII nor Fairy-Max are very strong), but you can of course still expect to be beaten regularly. Once you know the rules well enough, they should become beatable. XBoard/WinBoard has some facilities to help you learn (it will highlight where pieces can move) but I don't think it's perfect. I've been thinking what I'd like in a program for teaching some of these variants, possibly a mobile app. If you have any thoughts on what would be useful there, I'd be interested in hearing them.
Roger Brown
Posts: 782
Joined: Wed Mar 08, 2006 9:22 pm

Re: Engine development to play a chess variant

Post by Roger Brown »

Evert wrote: I had a long and detailed reply, but Safari just ate it. Perhaps the too long/didn't read version is better anyway:

I would probably recommend Pocket Knight, Capablanca/Gothic Chess, or Goro-Goro Shogi, in order of decreasing similarity to orthodox chess.

Pocket Knight only has familiar pieces, with one extra element compared to orthodox chess: an extra knight, to be dropped on the board on your move at will.

Capablanca/Gothic (they're the same really, except for the starting position) adds new pieces (the rook/knight and knight/bishop compounds) on a larger board (10x8). The same pieces are in Seirawan Chess, but I feel that the 8x8 board is too small to comfortably handle three queen-class pieces.

Goro-goro Shogi mostly has unfamiliar pieces, but they're all easy (they move to adjacent squares) and has drops, which add a very interesting dynamic to the game. The rules are easy to pick up, my almost-five year old was able to learn them quickly (albeit with a special for-children piece set), which means you're not bogged down with trying to remember all the rules, which is a problem with some other variants.

I'll put some more thoughts below, but feel free to stop reading here. If there's something I missed I'll follow up later.

There are some other variants that seem to be popular (in the sense that they're more commonly known) like Knightmate or Berolina Chess. Personally I think these are too gimmicky to be really interesting to play. Something like Fischer/Chess960 also counts as a variant, of course, but again it's not one that I think is particularly interesting. It seems to me more designed as a way to revitalise a waning interest in orthodox chess than as a game that is interesting in its own right. There's also Crazyhouse. Troitzky Chess is based on the idea that by making a small change to the chess board, KNNK becomes a forced win, which is neat but I'm not sure it makes the game particularly interesting. Legan's Chess effectively rotates the board by 45 degrees.

Although I think it's a really neat game, I would not recommend Spartan Chess as a first excursion in chess variant territory: you really need to learn the moves of six new piece types, and while none of them are hard I find it's a lot to take in. Definitely one of the better variants though.

Personally I have a weak spot for historical and regional variants, things like Shatranj, Courier, Makruk, Sittuyin, Shatar, Xiangqi and Shogi. Some of these games are quite slow though (Shatranj in particular). I think Xiangqi was the first chess variant I learned to play (apart from things like suicide/atomic/bughouse as a kid).

You could always just look at some of the games I listed and seeing if there is something that peeks your interest. A word of warning when playing any of these against a computer though: for many of the games, the computer is not very strong (neither SjaakII nor Fairy-Max are very strong), but you can of course still expect to be beaten regularly. Once you know the rules well enough, they should become beatable. XBoard/WinBoard has some facilities to help you learn (it will highlight where pieces can move) but I don't think it's perfect. I've been thinking what I'd like in a program for teaching some of these variants, possibly a mobile app. If you have any thoughts on what would be useful there, I'd be interested in hearing them.

Hello Evert,

Thank you for your reply.

I will definitely have a look.

Being beaten regularly by chess engines would not constitute a novel experience. Happens all the time.

:-)

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

Re: Engine development to play a chess variant

Post by hgm »

Evert wrote:
Choosing the initial placement of the new pieces fixes the rules and permits each army to think about a strategy. This also allows the enemy to seek for combinations (including checks or exchanging a virgin piece) sothat it wins an exchange and hampers the opponent from introducing a new piece.
Have you play-tested this? Not fixing the location where pieces can be gated immediately at the start of the game seems like it enhances the strategy by giving the player more options.
As far as I understood both sides can independently choose where they will be gated. The rules are not clear in what order this should be done. (I.e. whether black can make the location of its extra pieces dependent on how white places them.)

When white and black can choose the gating locations independently, it seems to me that it would be totally foolish to place any piece in an inferior location, as the opponentthen won't do that, and already creates an advantage. (That would be different if the opponent would be forced to also gate on the file you chose.) So you would just never choose the King as gating location, because that needlessly exposes you to loss of the piece-to-be-gated by a check, forces you to gate late, because you preumably would not want to move the King without castling, etc.

It is like making a Chess variant that only differs from normal Chess in that promotion is optional, and that you can also decide to leave a Pawn that reaches 7th rank a Pawn (after which it cannot move anymore). Subject to some complex rules, that you can only do that if you have at least one doubled Pawn somewhere on the board, and that it is forbidden to do so when the promotion delivers a (discovered) check...
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engine development to play a chess variant

Post by Ferdy »

hgm wrote:
Ferdy wrote:The KQ has gone but 2 new characters have appeared, the H and A. Something must have been going on in this virgin field, the KQ has become a couple, and they produce children A and H :).
For backward compatibility S-Chess FENs use the rule that AE should be replaced by Q and HE by K. (Which can again be generalized to outer Rooks and King, for the shuffle version.) And that pieces for which virginity has no consequences are not written.
It would have been better if the virgin file letter were declared as in,
KHGFEDCBAQkhgfedcbaq
so that we will not get confused if KQ are really virgins where in fact they are couple occupying the virgin field :).
The K and Q are redundant there, implied by the presence of H, E and A. Basically this is the same difference as between X-FEN and Shredder FEN in Chess960. You either right all the files (Shredder FEN), which is not backward compatible with FENs for orthodox Chess, or you use a convention that replaces the file IDs for K or Q whenever possible.


Btw, I still like the kludge where the order of the virginity file IDs correspond to piece types. To make that less dependent on a predefined ordering convention, one could say they correspond to the pieces in the order they are mentioned in the holdings. So

..... [LClc] w BGKQbgkq - 0 1

would mean that L can be gated at B, and C at G.
Certainly possible for musketeer.
hgm wrote: An alternative would be to allow specification of the gating file (or even square) in the holdings. E.g. like

[L(b)C(g)l(b)c(g)]

where a missing specifier would imply the entire back rank.
I don't like it when they are mixed, the with/without specifier.
hgm wrote: Or forget about holdings alltogether, and allow 'burried piece' in the board part of a FEN. After all, what the designer proposes is basically that the board has a 0th and 9th rank, on which those pieces start, rather than holdings. So

rn(l)bkqbn(c)r/pppppppp/8/8/8/8/PPPPPPPP/RN(L)BKQBN(C)R w KQkq - 0 1

meaning a Leopard is burried below the Queen's Knight, and a Cannon below the King's Knight.
I don't like it the piece field is now cluttered.
hgm wrote: I guess this could be used as a general method for writing FENs of games that allow stacking of pieces: indicate an entire stack in a square by surrounding it with parentheses or brackets:

r[nl]bkqb[nc]r/pppppppp/8/8/8/8/PPPPPPPP/R[NL]BKQB[NC]R w KQkq - 0 1

indicating stacks of N+L on b1/b8 and N+C on g1/g8.
Why not a format like this?

Code: Select all

<on-board pieces> <side to move> <castling rights> <ep> <hmvc> <fmvn> <on-hand pieces> <on-hand piece drop squares>
The first 6 fields are FEN format. The 8th field could be just a file id if rank is fixed or known at the beginning. For musketeer, the 7th field entries could be arranged to correspond to that of the 8th field, similar to what you said above. For s-chess the piece ordering can be ignored.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Engine development to play a chess variant

Post by hgm »

The board field might look a bit cluttered with () or [] groups in it. But what I like about it is that it has very general application, and is not just something that is only useful for a fringe case like very special gating rules.

How else could you write a FEN-like position description for the general case of games that allow stacking of multiple pieces on the same square?

In my mind the concept of hand/holdings as an off-board piece storage is only useful because it is not associated with a particular board location. A piece that can only appear on b1 (say) is really part of the spatially ordered board setup. You can think of it as being on a second layer of a two-layer 3D board, from which it can move down to the real board. So it makes sense to use either the general notation for 3D boards or that of stacking for Musketeer Chess.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engine development to play a chess variant

Post by Ferdy »

hgm wrote: How else could you write a FEN-like position description for the general case of games that allow stacking of multiple pieces on the same square?
White Cannon, and Leopard at b1
FEN [CL] [b1,b1]
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Engine development to play a chess variant

Post by hgm »

Well, it is not really FEN-like to explicitly mention the location of each piece; the whole idea of FEN is that the location is implied by the ordering of the pieces.