From 058f12c699c9183f93f280ad7eb54c8a1b25f523 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Tue, 2 Jun 2026 17:39:09 +0530 Subject: added move flags will try stockfish later dw --- src/engine/moves/knight.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/engine/moves/knight.c') diff --git a/src/engine/moves/knight.c b/src/engine/moves/knight.c index 5f5f9ad..20d072f 100644 --- a/src/engine/moves/knight.c +++ b/src/engine/moves/knight.c @@ -79,11 +79,14 @@ void get_knight_moves(moves_t* moves, position_t position) { bitboard_t friendly_knights; bitboard_t friendly_pieces; + bitboard_t enemy_pieces; if (position.turn == WHITE_TURN) { friendly_pieces = whites(position); + enemy_pieces = blacks(position); friendly_knights = position.bitboards[WHITE_KNIGHT]; } else { friendly_pieces = blacks(position); + enemy_pieces = whites(position); friendly_knights = position.bitboards[BLACK_KNIGHT]; } @@ -95,7 +98,13 @@ void get_knight_moves(moves_t* moves, position_t position) { while (ATTACK_MASK) { int to = __builtin_ctzll(ATTACK_MASK); ATTACK_MASK &= ATTACK_MASK - 1; - add_move(moves, from, to); + int capture = 0; + add_move( + moves, + from, + to, + .flags = ((enemy_pieces >> to) & 1) ? MOVE_CAPTURE : 0, + ); } } } -- cgit v1.2.3