summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-07-10 16:01:57 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-07-10 16:01:57 +0530
commita14da2fe3864712dab4e7c4cfb5c323026d668de (patch)
tree418c8c8ff44a611cbe1c1269b10926527046e232 /src/engine
parent2761f8a533e2b025f209222a1e4ec70b91c7e8ee (diff)
moving header files to include directory & moving resources in it's own directory
i know currently there is race condition, but the code is getting too messy, i will continue to this after i make a vis tool to analyse how i should split up files & stuff the code rn needs intense restructing for it to make any more progress
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/moves.c4
-rw-r--r--src/engine/moves.h81
-rw-r--r--src/engine/moves/bishop.c2
-rw-r--r--src/engine/moves/king.c2
-rw-r--r--src/engine/moves/knight.c2
-rw-r--r--src/engine/moves/pawn.c2
-rw-r--r--src/engine/moves/queen.c2
-rw-r--r--src/engine/moves/rook.c2
-rw-r--r--src/engine/moves/vec.c2
9 files changed, 10 insertions, 89 deletions
diff --git a/src/engine/moves.c b/src/engine/moves.c
index 797e770..56bb47d 100644
--- a/src/engine/moves.c
+++ b/src/engine/moves.c
@@ -1,5 +1,6 @@
#include "moves.h"
-#include "../bitboard.h"
+#include "bitboard.h"
+
#include "moves/vec.c"
#include "moves/king.c"
#include "moves/knight.c"
@@ -7,6 +8,7 @@
#include "moves/rook.c"
#include "moves/bishop.c"
#include "moves/queen.c"
+
#include <assert.h>
void get_moves(moves_t* moves, position_t position) {
diff --git a/src/engine/moves.h b/src/engine/moves.h
deleted file mode 100644
index 86c4844..0000000
--- a/src/engine/moves.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef MOVES_H
-#define MOVES_H
-
-#include "../ints.h"
-#include "../bitboard.h"
-
-typedef u8 square_t;
-
-// think about the chess move notation
-// e4, Nf6, Qh3+, Qe1#, a8=Q, i need to store the information needed to
-// recreate this in move_t
-enum {
- MOVE_CAPTURE = 1,
- MOVE_SHORT_CASTLE = 1 << 1,
- MOVE_LONG_CASTLE = 1 << 2,
-
- // technically these promotation flags can be compressed to only use 2 bits..
- MOVE_PROMOTE_Q = 1 << 3, // 1 << 5
- MOVE_PROMOTE_R = 1 << 4, // 2 << 5
- MOVE_PROMOTE_B = 1 << 5, // 3 << 5
- MOVE_PROMOTE_N = 1 << 6, // 4 << 5 ? nvm it uses 3
- MOVE_EN_PASSANT = 1 << 7,
- MOVE_CHECK = 1 << 8,
-};
-
-typedef struct {
- square_t from;
- square_t to;
- u16 flags;
-} move_t;
-void position_make_move(position_t* position, move_t* move);
-
-typedef struct {
- move_t* moves;
- u32 length;
- u32 capacity;
-} moves_t;
-
-moves_t moves_init();
-moves_t moves_init_wcapacity(u32 capacity);
-moves_t moves_empty();
-
-struct add_move_params {
- u16 flags;
-};
-#define add_move(moves, from, to, ...) _add_move(\
- moves, \
- from, \
- to, \
- (struct add_move_params) { .flags = 0, __VA_ARGS__ }\
-)
-void _add_move(
- moves_t* moves,
- square_t from,
- square_t to,
- struct add_move_params params
-);
-
-void get_pawn_moves(moves_t* moves, position_t position);
-void get_knight_moves(moves_t* moves, position_t position);
-void get_king_moves(moves_t* moves, position_t position);
-void get_rook_moves(moves_t* moves, position_t position);
-void get_bishop_moves(moves_t* moves, position_t position);
-void get_queen_moves(moves_t* moves, position_t position);
-
-void get_moves(moves_t* moves, position_t position);
-
-void __forloop_rook_moves_gen(
- moves_t* moves,
- bitboard_t friendly_type,
- bitboard_t friendly_pieces,
- bitboard_t enemy_pieces
-);
-void __forloop_bishop_moves_gen(
- moves_t* moves,
- bitboard_t friendly_type,
- bitboard_t friendly_pieces,
- bitboard_t enemy_pieces
-);
-
-#endif // !MOVES_H
diff --git a/src/engine/moves/bishop.c b/src/engine/moves/bishop.c
index c51d405..b69be57 100644
--- a/src/engine/moves/bishop.c
+++ b/src/engine/moves/bishop.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
void __forloop_bishop_moves_gen(
moves_t* moves,
diff --git a/src/engine/moves/king.c b/src/engine/moves/king.c
index e954ae5..1775e7f 100644
--- a/src/engine/moves/king.c
+++ b/src/engine/moves/king.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
#include <stdio.h>
void get_king_moves(moves_t* moves, position_t position) {
diff --git a/src/engine/moves/knight.c b/src/engine/moves/knight.c
index 20d072f..e7615f0 100644
--- a/src/engine/moves/knight.c
+++ b/src/engine/moves/knight.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
bitboard_t knight_moves[64] = {
132096ULL,
diff --git a/src/engine/moves/pawn.c b/src/engine/moves/pawn.c
index 0b8993f..d9757f4 100644
--- a/src/engine/moves/pawn.c
+++ b/src/engine/moves/pawn.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
#define add_promote_moves(other_flags) \
add_move(moves, from, to, .flags = other_flags | MOVE_PROMOTE_Q); \
diff --git a/src/engine/moves/queen.c b/src/engine/moves/queen.c
index 9e6e5c4..bdf96fc 100644
--- a/src/engine/moves/queen.c
+++ b/src/engine/moves/queen.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
void get_queen_moves(moves_t* moves, position_t position) {
assert_valid_position(position);
diff --git a/src/engine/moves/rook.c b/src/engine/moves/rook.c
index dfd9c32..3e0ac95 100644
--- a/src/engine/moves/rook.c
+++ b/src/engine/moves/rook.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
void __forloop_rook_moves_gen(
moves_t* moves,
diff --git a/src/engine/moves/vec.c b/src/engine/moves/vec.c
index 6a5f3c6..9ded70d 100644
--- a/src/engine/moves/vec.c
+++ b/src/engine/moves/vec.c
@@ -1,4 +1,4 @@
-#include "../moves.h"
+#include "moves.h"
#include <assert.h>
#include <stdlib.h>