fairy-stockfish / Fairy-Stockfish

chess variant engine supporting Xiangqi, Shogi, Janggi, Makruk, S-Chess, Crazyhouse, Bughouse, and many more
https://fairy-stockfish.github.io/
GNU General Public License v3.0
602 stars 189 forks source link

Support Spell Chess #736

Open M-DinhHoangViet opened 11 months ago

M-DinhHoangViet commented 11 months ago

New variant on Chess.com: https://www.chess.com/variants/spell-chess

RainRat commented 4 months ago

I did some thinking about Spell Chess and what the blockers are:

  1. Drops need to be able to be placed on occupied squares. It appears that under the hood, chess.com is also doing potions as drops, with log entries like "freeze@e4"

  2. Flexible drop order. Need to be able to drop, then move.

  3. Potions as a predefined piece that is put in pocket, and can be "dropped", but will not actually be placed on board.

[spell-chess]
freezePotion = f
jumpPotion = j
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR[JJFFFFFjjfffff] w KQkq - 0 1
  1. Since potion zones can overlap, 4 additional bitboards for potion zones

  2. Potion effect expiry. Doesn't need additional variable beyond bitboard. At end of your turn, zero potion zone bitboards that are not yours.

  3. Potion cooldown. Four (2 potions * 2 players) additional variables.

  4. Freeze potion effect. Remove any moves originating from freeze bitboards, from legal move list.

  5. Jump potion effect. Remove jump square from occupied bitboard, then calculate legal moves? Be sure to remove self-captures from list.