From ef40bc1fd40c32229738bfc8e60748802ca24c86 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Thu, 27 Feb 2020 20:56:48 +0100 Subject: [PATCH] Define simple gamestate structures --- board.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 board.h diff --git a/board.h b/board.h new file mode 100644 index 0000000..b8a6d52 --- /dev/null +++ b/board.h @@ -0,0 +1,30 @@ +/** + * Sudoku board header file + * + * Created by Gabriel Tofvesson + */ + + + +/** + * Simple definition of a board element. Vaild values range: 0-8 + */ +struct board_element { + unsigned char has_value : 1; /* Whether element has a decided value */ + + union { + unsigned char value : 4; /* Value of element */ + unsigned short potential : 9; /* Bitfield of possible values */ + }; +}; + +/** + * Board structure representing the state of a Sudoku game + * Complexity describes + * + * TODO: Replace elements with packed structure + */ +struct board { + struct board_element elements[81]; /* Game board */ + unsigned char complexity; /* Complexity of simplest element */ +};