Closed wthibault closed 6 months ago
Have a look at the signature of the Move::make
function https://disservin.github.io/chess-library/pages/move.html#general-implementation.
template <uint16_t MoveType = 0>
Move make(
Square source,
Square target,
PieceType pt = PieceType::KNIGHT
);
When you are creating a move this way you have to specify the MoveType and and PieceType (this is actually the promotion piece, knight is the default value because of the move encoding). If you just have the from and to square, you should consider using https://disservin.github.io/chess-library/pages/move.html#other-formats, though you need to handle to promotions slightly different.. i.e.
Move uciToMove(const Board& board, const std::string& uci);
uci is just e2e4
or e7e8q
, see https://backscattering.de/chess/uci/#move.
Thanks! that works.
Don't forget about the promotion case :)
I have in interactive application and collect to and from squares in the UI then check for legality, but enpassant don't appear in the movelist... It seems like this is handled in pgn input handling though? I have no pgn.