alexobviously / bishop

A chess logic package for Dart with flexible variant support
https://pub.dev/packages/bishop
Other
19 stars 8 forks source link

Deferred effects #18

Open alexobviously opened 1 year ago

alexobviously commented 1 year ago

Effects that don't happen immediately, but rather contain a condition that's checked after each move and can return wait, cancel, or trigger. So an effect that is meant to happen in 3 turns can contain a condition that compares state.halfMoves to the half moves at the time the effect was created +6, and trigger when it is, or wait otherwise. It's also possible to make a variation of this where the effect can be cancelled (I can think of some interesting ideas like a timed mine that explodes after x turns unless destroyed).

This is also needed for Janggi's bikjang rule - flying generals except it happens after the other player's turn if they don't move out of the way (side note: it seems like there are many variations of this rule where it forces a draw or a win or it's optional and so on, so the implementation needs to be flexible).

alexobviously commented 1 year ago

Planning to do this after dart 3.0 comes out with records because it will be nicer to implement what I have in mind (also allowing incrementing/decrementing/setting the value instead of just waiting/decrementing)

alexobviously commented 1 year ago

https://en.wikipedia.org/wiki/Congo_(chess_variant)#Drowning - interesting use case (the monkey in this variant depends on multimoves)