Currently we have a small selection of hardcoded promotion rules - pieces with promotable all get back the same list of promotable pieces. It's possible to define multiple promotion ranks, but it will always be the case that the final rank forces promo and the others are optional (i.e. you also get back a move without a promo piece).
Some cases that aren't supported but should be:
In Grand Chess (#12 ), only pieces that have been captured can be promoted to, so you can't have two queens for example. This is extra complicated because we don't currently have a way to know with 100% certainty which pieces have been captured. I think the best way is to conceptualise this as 'piece limits' instead, which should cover most use cases, and cases that aren't covered by this are probably so specific that you're going to need to write custom logic anyway.
Variants where pieces all promote to different pieces, like Shogi.
So the requirements are:
Nothing needed to implement the base case (standard chess), and no performance reduction for this case.
Minimal effort to implement common rules like those above - probably we just provide ready-made functions like with actions, but I think it's also important to simplify/clarify the API for looking up a piece by symbol.
It should be possible to define piece-specific promotion mapping (like Shogi) in the piece definitions themselves, which will presumably compile to promotion rules in the variant, like piece actions do.
Completely flexible for more complex rules.
I think the solution is to provide a callback for building promotion pieces in the variant, much like how actions work.
Currently we have a small selection of hardcoded promotion rules - pieces with
promotable
all get back the same list of promotable pieces. It's possible to define multiple promotion ranks, but it will always be the case that the final rank forces promo and the others are optional (i.e. you also get back a move without a promo piece).Some cases that aren't supported but should be:
So the requirements are:
I think the solution is to provide a callback for building promotion pieces in the variant, much like how actions work.