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

Blank Chess/Tabula Rasa chess #183

Open ckoshka opened 3 years ago

ckoshka commented 3 years ago

I've been reading through the wiki and variants.ini but I'm still lost about implement a variant like this (I don't really have a name for it but I guess a cool nice name would be Tabula Rasa chess):

  1. There's a 'pre-game' stage which uses Crazyhouse-like rules, but the board starts empty. Each player's moves are limited to dropping in one piece at a time, no moves allowed.
  2. The additional restriction is you can't place a piece in a way that puts your opponent in check, or in a way that immediately threatens another piece with being captured. (I was thinking of a third extension where you can't place your piece in a position that allows it to be captured, but I want to play around with it in Stockfish to see how it affects game dynamics first since it might be too restrictive.)
  3. If a player has no legal moves available during the pre-game stage, their opponent wins.
  4. Once all pieces have been played, the rules change back to standard chess.

I don't want to be a freeloader and ask the community for a full variant config file, but I'd really appreciate it if someone pointed me in the right direction!

ianfab commented 3 years ago

The rules for 1. and 4. can already be configured, 2. and 3. are a bit more problematic.

Since your variant is similar to standard chess, let's start by inheriting the rules from it:

[tabularasa:chess]

Then, you want to change the starting position as well as enable and enforce piece drops, so you set:

startFen = 8/8/8/8/8/8/8/8[KQRRBBNNPPPPPPPPkqrrbbnnpppppppp] w - - 0 1
pieceDrops = true
mustDrop = true

In order to prohibit checks by piece drops, you can add

dropChecks = false

Currently there unfortunately is no option to disallow piece drops that attack a piece. In order to achieve that a player loses if he does not have a legal move, you would currently need to set stalemate to be a loss, which would then however also apply to the later game phase. If you want to generally restrict the regions for piece drops, you can use whiteDropRegion/blackDropRegion for that.