src/chess/rules.c

changeset 78
ceb9197b3c6d
parent 69
c8f2c280cff7
--- a/src/chess/rules.c	Mon Jun 02 19:32:37 2025 +0200
+++ b/src/chess/rules.c	Mon Jun 02 19:40:24 2025 +0200
@@ -28,7 +28,13 @@
  */
 
 #include "rules.h"
-#include "chess.h"
+#include "pawn.h"
+#include "rook.h"
+#include "knight.h"
+#include "bishop.h"
+#include "queen.h"
+#include "king.h"
+
 #include <string.h>
 #include <stdlib.h>
 #include <sys/time.h>
@@ -45,32 +51,6 @@
     return simulation;
 }
 
-void gamestate_init(GameState *gamestate) {
-    memset(gamestate, 0, sizeof(GameState));
-    
-    Board initboard = {
-        {WROOK, WKNIGHT, WBISHOP, WQUEEN, WKING, WBISHOP, WKNIGHT, WROOK},
-        {WPAWN, WPAWN,   WPAWN,   WPAWN,  WPAWN, WPAWN,   WPAWN,   WPAWN},
-        {0,     0,       0,       0,      0,     0,       0,       0},
-        {0,     0,       0,       0,      0,     0,       0,       0},
-        {0,     0,       0,       0,      0,     0,       0,       0},
-        {0,     0,       0,       0,      0,     0,       0,       0},
-        {BPAWN, BPAWN,   BPAWN,   BPAWN,  BPAWN, BPAWN,   BPAWN,   BPAWN},
-        {BROOK, BKNIGHT, BBISHOP, BQUEEN, BKING, BBISHOP, BKNIGHT, BROOK}
-    };
-    memcpy(gamestate->board, initboard, sizeof(Board));
-}
-
-void gamestate_cleanup(GameState *gamestate) {
-    MoveList *elem;
-    elem = gamestate->movelist;
-    while (elem) {
-        MoveList *cur = elem;
-        elem = elem->next;
-        free(cur);
-    };
-}
-
 /* MUST be called BETWEEN validating AND applying a move to work correctly */
 static void format_move(GameState *gamestate, Move *move) {
     char *string = &(move->string[0]);

mercurial