Skip to content

Integrating new piece types

winapiadmin edited this page Nov 22, 2025 · 2 revisions

Since this is formerly MultiTypeChess, of course you can implement new piece types.

There's something that needs to be implemented for each new piece types:

  • Implement the piece enum (and also the forward declaration).
  • Write piece_of, and also color_of.
  • Modify enum_idx in types.h to calculate the linear index of the enum.
  • Instantitate the functions by adding INSTANTITATE(your_type) into moves_io.cpp, position.cpp and printers.cpp
  • Adding the mapped Zobrist table in zobrist.cpp, and also change size of zobrist::RandomPiece in zobrist.cpp (example in the codebase)

Test specification:

  1. Able to construct the corresponding enum value with make_piece, piece_of and color_of
  2. Handles NO_PIECE:
  • For color_of: return COLOR_NB (see #22)
  • For piece_of/type_of: return NO_PIECE_TYPE

Clone this wiki locally