summaryrefslogtreecommitdiff
path: root/src/search/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/moves.c
parent58b2c8b6e2041e63c46b579eccc141d21801e985 (diff)
restructing
Diffstat (limited to 'src/search/moves.c')
-rw-r--r--src/search/moves.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/search/moves.c b/src/search/moves.c
deleted file mode 100644
index c0cdb4e..0000000
--- a/src/search/moves.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "../search.h"
-#include <assert.h>
-#include <stdlib.h>
-
-void position_make_move(position_t* position, move_t* move) {
-
-}
-
-moves_t moves_init() {
- return moves_init_wcapacity(16);
-}
-
-moves_t moves_init_wcapacity(u32 capacity) {
- move_t* moves = malloc(capacity * sizeof(*moves));
- return (moves_t) {
- .moves = moves,
- .capacity = capacity,
- .length = 0,
- };
-}
-
-moves_t moves_empty() {
- return (moves_t) {
- .moves = 0,
- .capacity = 0,
- .length = 0,
- };
-}
-
-int min(int a, int b) {
- if (a > b) return b;
- return a;
-}
-
-void add_move(moves_t* moves, square_t from, square_t to) {
- assert(moves->moves != 0);
- assert(from != to);
-
- if (moves->length + 1 >= moves->capacity) {
- moves->capacity += min(32, moves->capacity);
- moves->moves = realloc(
- moves->moves,
- moves->capacity * sizeof(*moves->moves)
- );
- }
- moves->moves[moves->length] = (move_t){
- .from = from,
- .to = to
- };
- moves->length++;
-}