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
612 stars 191 forks source link

Custom DoubleStep pieces #634

Closed FlXME closed 1 year ago

FlXME commented 1 year ago

Problem

I made a custom pawn, but I encountered a problem: the doubleStep check is hardcoded with the regular pawn in both ucioption.cpp and apiutil.h. As a result, the custom pawn is unable to execute a double step (e.g. e2e4) because the move is rejected.

Change request

Please enable custom pawn types to perform double steps or add a PieceSet that is allowed to double step and includes the regular pawn by default.

variants.ini

[demo]
customPiece1 = m:fmWfceF
pawnTypes = m
startFen = rnbqkbnr/pppppppp/8/8/8/8/MMMMMMMM/RNBQKBNR w KQkq - 0 1
ianfab commented 1 year ago

This is already possible, see e.g. https://github.com/fairy-stockfish/Fairy-Stockfish/blob/bf310e8cbcd8fd171ef0a1b8a5144ea3681b0017/src/variants.ini#L296

Just make sure that you include "initial moves" (i) in the Betza notation as with the double step in the above example..