summaryrefslogtreecommitdiff
path: root/src/search/king_moves.c
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-05-27 18:02:44 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-05-27 18:02:44 +0530
commit2c2a70b69869f149c0407a62f1bf4c39899027a7 (patch)
tree9c3d194c32e82039fe6e0da9fbaf2e86aeef0a59 /src/search/king_moves.c
parent58b2c8b6e2041e63c46b579eccc141d21801e985 (diff)
restructing
Diffstat (limited to 'src/search/king_moves.c')
-rw-r--r--src/search/king_moves.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/search/king_moves.c b/src/search/king_moves.c
deleted file mode 100644
index 3f245cc..0000000
--- a/src/search/king_moves.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "../search.h"
-
-void get_king_moves(moves_t* moves, position_t position) {
- assert_valid_position(position);
-
- bitboard_t friendly_king;
- int king_square;
- bitboard_t friendly_pieces;
- if (position.turn == WHITE_TURN) {
- friendly_pieces = whites(position);
- friendly_king = position.bitboards[WHITE_KING];
- } else {
- friendly_pieces = blacks(position);
- friendly_king = position.bitboards[BLACK_KING];
- }
- king_square = __builtin_ctzll(friendly_king);
-
- bitboard_t movement;
- if (king_square >= 10) {
- movement = 920078ULL << (king_square - 10);
- } else {
- movement = 920078ULL >> -(king_square - 10);
- }
- if (friendly_king & BITMASK_FILE_A) {
- movement &= BITMASK_FILE_A | BITMASK_FILE_B;
- } else if (friendly_king & BITMASK_FILE_H) {
- movement &= BITMASK_FILE_G | BITMASK_FILE_H;
- }
-
- movement &= ~friendly_pieces;
- print_bitboard(movement);
- while (movement) {
- int to = __builtin_ctzll(movement);
- movement &= movement - 1;
- add_move(moves, king_square, to);
- }
-}
-
-#ifdef TEST_MOD
-#include <stdbool.h>
-#include "../bitboard.c"
-#include "./moves.c"
-
-bool test_empty_board() {
- int i = 0;
- while (i++ < 1000000000);
- return true;
-}
-
-bool test_friendly_pieces() {
- return false;
-}
-#endif