#include "board.h" #include "utils.h" void board_init (struct board *board, uint32_t rows, uint32_t cols) { bitarray_init (&board->bitarray, rows*cols); board->rows = rows; board->cols = cols; } void board_set (struct board *board, int32_t row, int32_t col, bool value) { ASSERT (board); row = MOD (row, (int32_t) board->rows); col = MOD (col, (int32_t) board->cols); bitarray_set (&board->bitarray, row*board->cols + col, value); } bool board_get (struct board *board, int32_t row, int32_t col) { ASSERT (board); row = MOD (row, (int32_t) board->rows); col = MOD (col, (int32_t) board->cols); return bitarray_get (&board->bitarray, row*board->cols + col); } void board_free (struct board *board) { bitarray_free (&board->bitarray); }