diff options
| author | eug-vs <eugene@eug-vs.xyz> | 2022-09-14 02:59:36 +0300 | 
|---|---|---|
| committer | eug-vs <eugene@eug-vs.xyz> | 2022-09-14 02:59:36 +0300 | 
| commit | f7901374649cd76ac52a6c881c79dc8d64e00981 (patch) | |
| tree | 4bc0f4aaa5c36b9618f70362f4b13f816216c11d /src/board.h | |
| parent | 87514fc685ea45241dbb00471388638e0be1b229 (diff) | |
| download | j1chess-f7901374649cd76ac52a6c881c79dc8d64e00981.tar.gz | |
feat: compute knight attack table
Diffstat (limited to 'src/board.h')
| -rw-r--r-- | src/board.h | 34 | 
1 files changed, 31 insertions, 3 deletions
| diff --git a/src/board.h b/src/board.h index f7e89f2..154878c 100644 --- a/src/board.h +++ b/src/board.h @@ -10,7 +10,7 @@  #define QUEEN  0b1000  #define KING   0b1010 -typedef QWORD Bitboard; +typedef U64 Bitboard;  typedef struct {    Bitboard pieces[12]; @@ -19,6 +19,33 @@ typedef struct {    BYTE en_passant_square;  } Board; +enum enumSquare { +  a1, b1, c1, d1, e1, f1, g1, h1, +  a2, b2, c2, d2, e2, f2, g2, h2, +  a3, b3, c3, d3, e3, f3, g3, h3, +  a4, b4, c4, d4, e4, f4, g4, h4, +  a5, b5, c5, d5, e5, f5, g5, h5, +  a6, b6, c6, d6, e6, f6, g6, h6, +  a7, b7, c7, d7, e7, f7, g7, h7, +  a8, b8, c8, d8, e8, f8, g8, h8 +}; + +#define notAFile 0xFEFEFEFEFEFEFEFE +#define notBFile 0xFDFDFDFDFDFDFDFD +#define notGFile 0xBFBFBFBFBFBFBFBF +#define notHFile 0x7F7F7F7F7F7F7F7F + +static const char* notation[64] = { +  "a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1", +  "a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2", +  "a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3", +  "a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4", +  "a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5", +  "a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6", +  "a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7", +  "a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8" +}; +  static const char* pieces[] = {    "♟︎", "♙",    "♞", "♘", @@ -28,5 +55,6 @@ static const char* pieces[] = {    "♚", "♔",  }; -void index_to_notation(BYTE index, char notation[2]); -BYTE notation_to_index(char file, int rank); +void precompute_knight_attack_table(); +void print_bitboard(Bitboard bb); +int pop_count(Bitboard bb); | 
