Support variants that can split pieces v4.9.x
authorH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 28 Nov 2025 13:29:14 +0000 (14:29 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 28 Nov 2025 13:46:38 +0000 (14:46 +0100)
commit26729840f3eb64e5920fb191b08bffb5cdf126a6
tree0a1f39b024cf47b9acd21fbb2c5fd1272fd040cf
parentb72ccfb1ceec5a63d41edc4aadec91577bb891aa
Support variants that can split pieces

CECP is extended by a new engine-GUI command 'split', which transfers a
matrix that specifies which piece should be left on the from-square after
a move. This can be dependent on the moved piece type, but also on the
type it promotes to. It is transferred as a matrix filled with the ID of
the piece to be left behind, where rows are separated by slashes. Each row
starts with the ID for non-promoting moves, and then (optionally) continues
with the cases for promotion choices in pieceToCharTable order.
  E.g., to have a Knight leave behind Pawns in otherwise normal Chess,
the engine can send:

split /P//////p

where non-,emmtioned and empty rows are taken to specify the from-square
should be left empty. To specify promotion to Knight should actually give
you two Knights (other promotions being unaffected) the engine could send

split --N//////--------n

The split command only works in engine-defined variants, and should be
sent after 'setup' in order for the pieceToCharTable (needed to interpret
it) to be known.
  Beware that the format allows for enemy promotion, so that the black
promotion choices come late in the row.
backend.c