summaryrefslogtreecommitdiff
path: root/board.h
blob: f795d0351057893174a69b94c9e6644e75159c52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <stdbool.h>
#include <stdint.h>

typedef uint64_t u64;
typedef uint8_t u8;


// as bit array: [16 * y + 4 * x + z]
// (x,y) = floor position, z = height with z=0 on the bottom
typedef u64 board_t[2];
typedef const u64 cboard_t[2];

enum win_t {
	WIN_NONE,
	WIN_P0,
	WIN_P1,
	WIN_DRAW,
};

void b_set(board_t B, cboard_t C);
void b_drop(board_t B, int xy, int v);
bool b_stk_full(cboard_t B, int xy);
enum win_t b_win(cboard_t B);