diff --git a/make.deps b/make.deps index 7fa7bce..1df5635 100644 --- a/make.deps +++ b/make.deps @@ -1,10 +1,10 @@ ./obj/debug.o:: src/debug.c src/debug.h ./obj/fen.o:: src/fen.c src/debug.h src/chessdefs.h src/position.h src/board.h \ - src/list.h src/fen.h src/piece.h src/pool.h -./obj/move.o:: src/move.c src/chessdefs.h src/piece.h src/board.h src/list.h \ - src/position.h src/pool.h src/move.h -./obj/piece.o:: src/piece.c src/chessdefs.h src/piece.h src/board.h src/list.h \ - src/position.h src/pool.h src/debug.h + src/piece.h src/list.h src/pool.h src/fen.h +./obj/move.o:: src/move.c src/chessdefs.h src/piece.h src/board.h src/position.h \ + src/list.h src/pool.h src/move.h +./obj/piece.o:: src/piece.c src/chessdefs.h src/piece.h src/board.h \ + src/position.h src/list.h src/pool.h src/debug.h ./obj/pool.o:: src/pool.c src/list.h src/pool.h src/debug.h ./obj/position.o:: src/position.c src/chessdefs.h src/position.h src/board.h \ - src/list.h src/fen.h src/piece.h src/pool.h + src/piece.h src/list.h src/pool.h src/fen.h diff --git a/src/board.h b/src/board.h index d0cdff4..98a08e8 100644 --- a/src/board.h +++ b/src/board.h @@ -16,10 +16,12 @@ #include #include "chessdefs.h" +#include "piece.h" +#include "position.h" -typedef struct { +typedef struct board_s { piece_t piece; - //piece_t *s_piece; + piece_list_t *s_piece; } board_t; /* 0x88 board */ #define BOARDSIZE (8*8*2) @@ -51,4 +53,4 @@ typedef struct { #define FILE2C(f) ((f) + 'a') #define RANK2C(r) ((r) + '1') -#endif +#endif /* BOARD_H */ diff --git a/src/chessdefs.h b/src/chessdefs.h index 12db0cd..c833983 100644 --- a/src/chessdefs.h +++ b/src/chessdefs.h @@ -73,4 +73,10 @@ typedef unsigned char castle_t; */ typedef int64_t eval_t; +/* forward typedefs + */ +typedef struct piece_list_s piece_list_t; +typedef struct board_s board_t; +typedef struct pos_s pos_t; + #endif diff --git a/src/fen.c b/src/fen.c index f3e0cf4..2b8014f 100644 --- a/src/fen.c +++ b/src/fen.c @@ -84,7 +84,7 @@ pos_t *fen2pos(pos_t *pos, char *fen) # endif piece |= color; board[SQ88(file, rank)].piece = piece; - piece_add(pos, piece, SQUARE(file, rank)); + board[SQ88(file, rank)].s_piece = piece_add(pos, piece, SQUARE(file, rank)); file++; break; case '/': diff --git a/src/piece.h b/src/piece.h index 2c5bde2..1536776 100644 --- a/src/piece.h +++ b/src/piece.h @@ -14,12 +14,13 @@ #ifndef PIECE_H #define PIECE_H +#include + #include "chessdefs.h" #include "board.h" #include "list.h" #include "position.h" #include "pool.h" -#include "ctype.h" #define PIECE_DEFAULT_VALUE 0 @@ -31,7 +32,7 @@ #define QUEEN_VALUE 900 #define KING_VALUE 20000 -typedef struct { +typedef struct piece_list_s { piece_t piece; square_t square; short castle; diff --git a/src/position.h b/src/position.h index 5e0a7e5..2e3ad65 100644 --- a/src/position.h +++ b/src/position.h @@ -19,7 +19,7 @@ #include "board.h" #include "list.h" -typedef struct position { +typedef struct pos_s { piece_t turn; /* we use only color bit */ castle_t castle; square_t en_passant;