Engine development to play a chess variant

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27796
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 »

One problem is that S-Chess initial positions always need the King and Rooks to be marked as 'virgin', so that it will automatically allow gating on King and Rook squares, even when Musketeer Chess would only allow gating on b- and c- files. In addition, marking BCbc as virgin, will still not tell you what piece type you could gate where. So S-Chess FENs are really not adequate for indicating Musketeer opening positions. Of course we could adopt the convention that only the first two mentioned virgin pieces indicate gating rights in Musketeer, mapping to the piece types in some canonical order. E.g. HCAEhcae could be used to indicate Leopard can gate at Hh and Cannon at Cc, while the AEae is then only present for indicating castling rights.

Btw, I am very skeptical about these predetermined gating squares and complex rules for gating on checks. They seem to introduce a lot of complexity for no real purpose. (Who would allow his King to be checked before castling? If there is a real possibility that your King might be checked, who would be so stupid to place a piece behind the King?) It smells a lot like rules for rule's sake...

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

This would display the Leopard as a lion, in WinBoard 4.8, which seems the closest thing. (XBoard 4.8 actually does have a Leopard image, for Chu Shogi! But not WinBoard.)

Note that you could make this a shuffle variant, where the engine would randomly select the two exo-pieces to participate and where to gate them, adapt the pieceToCharTable and FEN accordingly. This requires the engine to understand the IDs for all possible pieces in 'setboard', and have this overrule its own random choice, as the second engine will be fed the position specified by the first.

In human-engine games the user would have to be informed through a popup ('telluser' command) where he could gate the pieces, at the start of each game.
User avatar
musketeerchess
Posts: 161
Joined: Sun Apr 21, 2013 2:02 pm
Location: Paris, France

Re: Engine development to play a chess variant

Post by musketeerchess »

Hi
if there is a double checker and u move your king by capturing one of the checkers, the second checker isn't captured.

You forfeit your right to introduce a new piece.
inventor of Musketeer Chess. A modern commercial chess variant.

www.musketeerchess.net

Pieces are available on Houseofstaunton.com or Paypal
User avatar
musketeerchess
Posts: 161
Joined: Sun Apr 21, 2013 2:02 pm
Location: Paris, France

Re: Engine development to play a chess variant

Post by musketeerchess »

Hi

Gating the new pieces is really very simple.

First you choose "the virgin pieces" (pieces that haven't yet moves) and you put the new pieces behind one of those virgin pieces. This means, when this virgin piece will move for the first time, it authorizes the introduction (or gating) of the new piece.

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.

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.

I assume that the rules are maybe difficult to program for an engine, but it's the rule. 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.

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
inventor of Musketeer Chess. A modern commercial chess variant.

www.musketeerchess.net

Pieces are available on Houseofstaunton.com or Paypal
User avatar
musketeerchess
Posts: 161
Joined: Sun Apr 21, 2013 2:02 pm
Location: Paris, France

Re: Engine development to play a chess variant

Post by musketeerchess »

10. If black’s king is in check and the black king moves without
capturing the piece that checks, black forfeits his right to
introduce the Fortress, etc.


This concerns not only the Fortress but also all the new pieces. The Fortress was just taken here as an example.


11. When promoting, a pawn can be promoted into any of the Classic
Chess pieces (except the King) and equally into any of the new men
that were part of the game. For example, the game began with
Cannon and Unicorn. If a pawn is promoted, it cannot be promoted
to a Leopard, but it can be promoted to a Cannon or a Unicorn.
If a second pawn is promoted, it can be promoted to a Cannon
or Unicorn again (we can then see 2 of the same colored Cannons
on the playing board, etc).


In number 10, if there is double checker and you capture one checker, does this mean that you can now make a gate move? A gate move is a move where you introduce a new piece.

As i said in the previous post, in this case the right to introduce a new piece is forfeited.



Number 7 and number 10 seems related or number 10 is only applicable for the Fortress piece?

It's applicable for all the new pieces.


How do you handle a case where the gate move is executed but the new introduced piece covers its own king from check.


Can the bishop in C1 able to make a legal move say to d2 and gate a Leopard or Cannon in C1 for example?
In s-chess this is not allowed.
[d]4k1n1/4p3/8/8/8/8/8/r1B1K2R w K - 0 1

:: :: BK :: BN ::
:: :: BP ::
:: :: :: ::
:: :: :: ::
:: :: :: ::
:: :: :: ::
:: :: :: ::
BR WB WK :: WR

[/b] The Bishop c1 cannot move (like in orthodox chess) because it discovers the king. I remind you that the piece is only introduced after the virgin piece moves. If the virgin piece protects the king from a check than it cannot move.
[/b]
inventor of Musketeer Chess. A modern commercial chess variant.

www.musketeerchess.net

Pieces are available on Houseofstaunton.com or Paypal
User avatar
hgm
Posts: 27796
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, what is 'beautiful' is a matter of taste, about which arguing is pointless. In general I consider breaking of symmetries ugly, and allowing gating only at one square rather than anywere as in Seirawan Chess, breaks a symmetry.

As for the effect on the game, in Seirawan Chess there is an interesting dilemma for when to gate. When you do it too early, the opponent will know where the piece appeared, and can adapt his strategy to it. The later you gate, the longer you keem him in the dark, and he will have to pre-emptively defed against the piece appearing anywhere. If you wait too long, however, you become vulnerable to tactics that destroy your last gating possibility, and effectively lose you a (super-)piece.

By fixing the gating square you lose all that, and you would just gate at the earliest opportunity to minimize the risk. It also strongly reduces the size of the game tree in the opening phase, making it easier to develop opening theory, which is in general seen as undesirable.

And although you aregue that the extra rules for gating are simple: no rules is always simpler than simple rules...
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:One problem is that S-Chess initial positions always need the King and Rooks to be marked as 'virgin', so that it will automatically allow gating on King and Rook squares,
Why not
[KQkqABCDEFGHabcdefgh]?
After a white rook move a1a2h, the rights could be
[KkqBCDEFGHabcdefgh]
Something like separate the castling rights from gating rights but join them in one field.
hgm wrote: even when Musketeer Chess would only allow gating on b- and c- files. In addition, marking BCbc as virgin, will still not tell you what piece type you could gate where.
Correct, I will just let the engine choose what piece type will gate to legal available squares. Not really a full musketeer compliant engine :).
hgm wrote: Btw, I am very skeptical about these predetermined gating squares and complex rules for gating on checks. They seem to introduce a lot of complexity for no real purpose. (Who would allow his King to be checked before castling? If there is a real possibility that your King might be checked, who would be so stupid to place a piece behind the King?) It smells a lot like rules for rule's sake...
I hope the inventor will look into that, as I am also struggling to implement "if I am in check, I can gate if I can capture the attacker" :). It should have been better if if I am in check no gating is allowed.
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

This would display the Leopard as a lion, in WinBoard 4.8, which seems the closest thing. (XBoard 4.8 actually does have a Leopard image, for Chu Shogi! But not WinBoard.)

Note that you could make this a shuffle variant, where the engine would randomly select the two exo-pieces to participate and where to gate them, adapt the pieceToCharTable and FEN accordingly. This requires the engine to understand the IDs for all possible pieces in 'setboard', and have this overrule its own random choice, as the second engine will be fed the position specified by the first.

In human-engine games the user would have to be informed through a popup ('telluser' command) where he could gate the pieces, at the start of each game.
I will try to do some reading on that.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Engine development to play a chess variant

Post by Ferdy »

musketeerchess wrote:10. If black’s king is in check and the black king moves without
capturing the piece that checks, black forfeits his right to
introduce the Fortress, etc.


This concerns not only the Fortress but also all the new pieces. The Fortress was just taken here as an example.


11. When promoting, a pawn can be promoted into any of the Classic
Chess pieces (except the King) and equally into any of the new men
that were part of the game. For example, the game began with
Cannon and Unicorn. If a pawn is promoted, it cannot be promoted
to a Leopard, but it can be promoted to a Cannon or a Unicorn.
If a second pawn is promoted, it can be promoted to a Cannon
or Unicorn again (we can then see 2 of the same colored Cannons
on the playing board, etc).


In number 10, if there is double checker and you capture one checker, does this mean that you can now make a gate move? A gate move is a move where you introduce a new piece.

As i said in the previous post, in this case the right to introduce a new piece is forfeited.
Then why you are replying to this post? You should reply to my other post.
When you reply to a certain post, press the quote button.
User avatar
hgm
Posts: 27796
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 »

Ferdy wrote:Why not
[KQkqABCDEFGHabcdefgh]?
After a white rook move a1a2h, the rights could be
[KkqBCDEFGHabcdefgh]
Something like separate the castling rights from gating rights but join them in one field.
Well, the justification for indicating these in the same field was that this field could be interpreted as the 'virginity' field, and that both castling and gating depended on virginity. If castling and gating are governed by different things, it would really be mor logical to have separate fields for those.
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:Why not
[KQkqABCDEFGHabcdefgh]?
After a white rook move a1a2h, the rights could be
[KkqBCDEFGHabcdefgh]
Something like separate the castling rights from gating rights but join them in one field.
Well, the justification for indicating these in the same field was that this field could be interpreted as the 'virginity' field, and that both castling and gating depended on virginity. If castling and gating are governed by different things, it would really be mor logical to have separate fields for those.
At start position this is the virgin field, KGFDCBQkgfdcbq.

Code: Select all

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[HEhe] w KGFDCBQkgfdcbq - 0 1
After moving white king from e1 to e2, this is the virgin field, HGFDCBAkgfdcbq

Code: Select all

rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPPKPPP/RNBQ1BNR[HEhe] b HGFDCBAkgfdcbq - 1 2
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 :).
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 :).
User avatar
hgm
Posts: 27796
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 »

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.

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. 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.

This seems preferable to

1l4c1/rnbkqbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBKQBNR/1L4C1 w KQkq - 0 1

as the latter would not imply the C and L are pulled to the Knight squares when the latter move, and that the 0th and 9th rank are inaccessible.


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.