summaryrefslogtreecommitdiff
path: root/src/engine/moves/knight.c
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-06-02 17:39:09 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-06-02 17:39:09 +0530
commit058f12c699c9183f93f280ad7eb54c8a1b25f523 (patch)
treef06f21c94666243b80a5823c3932349dba4ed3cc /src/engine/moves/knight.c
parentdf577a30f2df1d60a0254403147fd2077a7c8b42 (diff)
added move flags
will try stockfish later dw
Diffstat (limited to 'src/engine/moves/knight.c')
-rw-r--r--src/engine/moves/knight.c11
1 files changed, 10 insertions, 1 deletions
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,
+ );
}
}
}