new pos/bb funcs, legal(), better castling gen, etc. [see commit details]

- new sq_pinners
- new pseudo_is_legal() (unfinished)
- improve castling pseudo move gen

- more position and lower level bitboard helper funcs:
  - pos_{_occ,between_occ,between_count,pinners}
  - bb_{rank,file,rel_rank,_sq_aligned,_sq_between)
- rename some bitboard globals
- replace bb ranks/files enums with defines (issue with clang)
  -> Need to find a way to use enum safely
- tests:
  - add common-test.h
  - new attack-test.c
This commit is contained in:
2024-03-07 10:50:19 +01:00
parent b351d198b8
commit 87e7695873
20 changed files with 913 additions and 373 deletions

View File

@@ -19,6 +19,7 @@
#include "move.h"
#include "position.h"
/*
* /\**
* * move_print() - print a move
@@ -114,7 +115,6 @@ void moves_print(pos_t *pos, __unused int flags)
printf("\n");
}
static int _moves_cmp_bysquare(const void *p1, const void *p2)
{
move_t m1 = *(move_t *)p1;
@@ -131,6 +131,7 @@ static int _moves_cmp_bysquare(const void *p1, const void *p2)
if (t1 > t2) return 1;
return 0;
}
/**
* move_sort_by_sq() - sort moves by from/to squares ascending
* @pos: position.