codex
|
#include <assert.h>
#include <ctype.h>
#include <stdbool.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 u8 | position |
Enumerations | |
enum | { EMPTY , 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 | |
position | position0 (u8 i) |
position | position1 (u8 i) |
bool | is_empty (position p) |
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 | |
static 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 uint8_t u8 |
anonymous enum |
bool color | ( | position | p | ) |
bool is_empty | ( | position | p | ) |
int main | ( | void | ) |
|
static |
|
static |