Leptonica 1.68
C Image Processing Library
|
00001 /*====================================================================* 00002 - Copyright (C) 2001 Leptonica. All rights reserved. 00003 - This software is distributed in the hope that it will be 00004 - useful, but with NO WARRANTY OF ANY KIND. 00005 - No author or distributor accepts responsibility to anyone for the 00006 - consequences of using this software, or for whether it serves any 00007 - particular purpose or works at all, unless he or she says so in 00008 - writing. Everyone is granted permission to copy, modify and 00009 - redistribute this source code, for commercial or non-commercial 00010 - purposes, with the following restrictions: (1) the origin of this 00011 - source code must not be misrepresented; (2) modified versions must 00012 - be plainly marked as such; and (3) this notice may not be removed 00013 - or altered from any source or modified source distribution. 00014 *====================================================================*/ 00015 00016 #ifndef SUDOKU_H_INCLUDED 00017 #define SUDOKU_H_INCLUDED 00018 00019 /* 00020 * sudoku.h 00021 * 00022 * The L_Sudoku holds all the information of the current state. 00023 * 00024 * The input to sudokuCreate() is a file with any number of lines 00025 * starting with '#', followed by 9 lines consisting of 9 numbers 00026 * in each line. These have the known values and use 0 for the unknowns. 00027 * Blank lines are ignored. 00028 * 00029 * The @locs array holds the indices of the unknowns, numbered 00030 * left-to-right and top-to-bottom from 0 to 80. The array size 00031 * is initialized to @num. @current is the index into the @locs 00032 * array of the current guess: locs[current]. 00033 * 00034 * The @state array is used to determine the validity of each guess. 00035 * It is of size 81, and is initialized by setting the unknowns to 0 00036 * and the knowns to their input values. 00037 */ 00038 struct L_Sudoku 00039 { 00040 l_int32 num; /* number of unknowns */ 00041 l_int32 *locs; /* location of unknowns */ 00042 l_int32 current; /* index into @locs of current location */ 00043 l_int32 *init; /* initial state, with 0 representing */ 00044 /* the unknowns */ 00045 l_int32 *state; /* present state, including inits and */ 00046 /* guesses of unknowns up to @current */ 00047 l_int32 nguess; /* shows current number of guesses */ 00048 l_int32 finished; /* set to 1 when solved */ 00049 l_int32 failure; /* set to 1 if no solution is possible */ 00050 }; 00051 typedef struct L_Sudoku L_SUDOKU; 00052 00053 00054 /* For printing out array data */ 00055 enum { 00056 L_SUDOKU_INIT = 0, 00057 L_SUDOKU_STATE = 1 00058 }; 00059 00060 #endif /* SUDOKU_H_INCLUDED */ 00061 00062