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

@@ -115,7 +115,7 @@ void moves_print(pos_t *pos, __unused int flags)
}
static int _moves_comp_square(const void *p1, const void *p2)
static int _moves_cmp_bysquare(const void *p1, const void *p2)
{
move_t m1 = *(move_t *)p1;
move_t m2 = *(move_t *)p2;
@@ -129,7 +129,7 @@ static int _moves_comp_square(const void *p1, const void *p2)
/* f1 == f2 */
if (t1 < t2) return -1;
if (t1 > t2) return 1;
return 0; /* DUP BUG ! */
return 0;
}
/**
* move_sort_by_sq() - sort moves by from/to squares ascending
@@ -139,7 +139,7 @@ static int _moves_comp_square(const void *p1, const void *p2)
*/
void move_sort_by_sq(pos_t *pos)
{
qsort(pos->moves.move, pos->moves.nmoves, sizeof(move_t), _moves_comp_square);
qsort(pos->moves.move, pos->moves.nmoves, sizeof(move_t), _moves_cmp_bysquare);
}
/*