codex
|
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include "chess_common.h"
Classes | |
struct | board |
Macros | |
#define | P(c, t0, t1) |
#define | R(i, c, t0, t1, t2, t3, t4, t5, t6, t7) [i] = P(c, t0, t1), P(c, t2, t3), P(c, t4, t5), P(c, t6, t7) |
Typedefs | |
typedef uint8_t | u8 |
typedef uint64_t | u64 |
typedef u8 | position |
Enumerations | |
enum | { PAWN , ROOK , KNIGHT , BISHOP , QUEEN , KING , WHITE = 0 , BLACK = 1 , POS_BITS = 4 , PIECE_BITS = 3 , POS_MASK = (1 << POS_BITS) - 1 , PIECE_MASK = (1 << PIECE_BITS) - 1 , COLOR_MASK = (1 << PIECE_BITS) } |
Functions | |
bool | is_empty (const struct board *b, u8 x, u8 y) |
int | popcnt (u64 n) |
position | position0 (u8 i) |
position | position1 (u8 i) |
bool | color (position p) |
u8 | piece (position p) |
position | board_position (const struct board *b, u8 x, u8 y) |
static void | print_pos (const struct board *b, int x, int y) |
int | main (void) |
Variables | |
const struct board | b |
#define P | ( | c, | |
t0, | |||
t1 ) |
#define R | ( | i, | |
c, | |||
t0, | |||
t1, | |||
t2, | |||
t3, | |||
t4, | |||
t5, | |||
t6, | |||
t7 ) [i] = P(c, t0, t1), P(c, t2, t3), P(c, t4, t5), P(c, t6, t7) |
typedef uint64_t u64 |
typedef uint8_t u8 |
anonymous enum |
bool color | ( | position | p | ) |
int main | ( | void | ) |
int popcnt | ( | u64 | n | ) |
|
static |
const struct board b |