sq_attackers() + others (see dedails). Ready for move do/undo ?

- add many "const" in func parameters
- attack.c: sq_attackers()
- move print_board_raw from position.c to to board.c
- move some fen_check() tests to pos_check()
- add REL_RANK() macro. TODO: add one more for bitboards
- fen.c: more tests for FEN validity
- position.c: add pos_checkers() and pos_check()
- tests: add common-test.h (for shared FEN positions access)
This commit is contained in:
2024-03-04 21:34:29 +01:00
parent a499893f32
commit b351d198b8
18 changed files with 584 additions and 482 deletions

View File

@@ -35,22 +35,11 @@ typedef struct __pos_s {
square_t en_passant;
castle_rights_t castle;
//eval_t eval;
//int check[2];
//int eval_simple_phase;
//eval_t eval_simple;
//move_t *bestmove;
//bool moves_generated;
//bool moves_counted;
bitboard_t bb[2][PIECE_TYPE_MAX]; /* bb[0][PAWN], bb[1][ALL_PIECES] */
bitboard_t controlled[2];
//u16 mobility[2];
//struct list_head pieces[2]; /* pieces list, King is first */
//struct list_head moves[2];
bitboard_t controlled[2]; /* unsure */
bitboard_t checkers; /* opponent checkers */
piece_t board[BOARDSIZE];
movelist_t moves;
//int nmoves;
} pos_t;
/**
@@ -93,18 +82,20 @@ static inline void pos_clr_sq(pos_t *pos, square_t square)
//void bitboard_print2(bitboard_t bb1, bitboard_t bb2, char *title);
extern pos_t *pos_new();
extern pos_t *pos_dup(pos_t *pos);
extern pos_t *pos_dup(const pos_t *pos);
extern void pos_del(pos_t *pos);
extern pos_t *pos_clear(pos_t *pos);
extern void pos_print(pos_t *pos);
extern void pos_print_mask(pos_t *pos, bitboard_t mask);
extern void pos_pieces_print(pos_t *pos);
extern bitboard_t pos_checkers(const pos_t *pos, const color_t color);
extern char *pos_checkers2str(const pos_t *pos, char *str);
extern void pos_print_board_raw(const pos_t *pos, int type);
extern int pos_check(const pos_t *pos, const int strict);
//extern pos_t *pos_startpos(pos_t *pos);
extern void pos_print(const pos_t *pos);
extern void pos_print_mask(const pos_t *pos, const bitboard_t mask);
extern void pos_print_raw(const pos_t *pos, const int type);
extern void pos_print_pieces(const pos_t *pos);
//void pos_check(position *pos);
#endif /* POSITION_H */