32 lines
873 B
C
32 lines
873 B
C
|
// The puzzle represents a Sudoku board where some cells may still be empty.
|
||
|
//
|
||
|
// All solve failures and inconsistencies are handled by crashing the program
|
||
|
// -- if puzzle_solve completes, then solved_board contains a copy of
|
||
|
// input_board where every blank tile is now set to some digit value.
|
||
|
|
||
|
#ifndef PUZZLE_H
|
||
|
#define PUZZLE_H
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include "shared.h"
|
||
|
#include "puzzle_options.h"
|
||
|
|
||
|
typedef struct {
|
||
|
tile_t input_board[N_CELLS];
|
||
|
tile_t solved_board[N_CELLS];
|
||
|
puzzle_options_t options[N_CELLS];
|
||
|
} puzzle_t;
|
||
|
|
||
|
|
||
|
// Create a puzzle whose input board is as given.
|
||
|
//
|
||
|
// You probably want puzzle_init_string from puzzle_io.h instead..
|
||
|
void puzzle_init(puzzle_t* puzzle, const tile_t board[N_CELLS]);
|
||
|
|
||
|
// Solve the puzzle.
|
||
|
//
|
||
|
// If this returns, the puzzle is solved. (Otherwise, we crash the process.)
|
||
|
void puzzle_solve(puzzle_t* puzzle);
|
||
|
|
||
|
#endif
|