From 363d8ea45c53591bda14c6bd9fa8ddfcd47eb487 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 5 Feb 2019 14:29:25 +0100 Subject: Initial --- board.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 board.h (limited to 'board.h') diff --git a/board.h b/board.h new file mode 100644 index 0000000..f795d03 --- /dev/null +++ b/board.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include + +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); -- cgit v1.2.3-70-g09d2