Add load() for loading sudokus from text
This commit is contained in:
7
sud.h
7
sud.h
@@ -23,6 +23,7 @@
|
||||
|
||||
#define SEGLEN 3
|
||||
#define NDIGITS (SEGLEN * SEGLEN)
|
||||
#define NCELLS (NDIGITS * NDIGITS)
|
||||
|
||||
struct cellstate {
|
||||
bool det;
|
||||
@@ -40,6 +41,12 @@ enum update_res { NOT_ALLOWED, ALREADY_DET, OK };
|
||||
|
||||
enum check_res { INCOMPLETE, INCORRECT, SOLVED };
|
||||
|
||||
/**
|
||||
* Read `NCELLS` values from the given pointer and load them into the
|
||||
* sudoku.
|
||||
*/
|
||||
bool load(struct sudoku *sud, const char *ptr);
|
||||
|
||||
/**
|
||||
* Populate the sudoku with some random values. The proportion of
|
||||
* cells that are filled will be approximately `fill_prop`.
|
||||
|
||||
Reference in New Issue
Block a user