X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=latin.h;h=4b09f16ce16051e3c28a25979e9842f87e300019;hb=3234912f921916a1b8da164fd61dc75579358577;hp=dbea6e4ee01ffdbd69fad20b879ec195109409fa;hpb=189f83398081b228440134f0163c56f5b662c5f4;p=sgt-puzzles.git diff --git a/latin.h b/latin.h index dbea6e4..4b09f16 100644 --- a/latin.h +++ b/latin.h @@ -8,7 +8,7 @@ typedef unsigned char digit; /* --- Solver structures, definitions --- */ #ifdef STANDALONE_SOLVER -int solver_show_working, solver_recurse_depth; +extern int solver_show_working, solver_recurse_depth; #endif struct latin_solver { @@ -19,6 +19,10 @@ struct latin_solver { unsigned char *row; /* o^2: row[y*cr+n-1] TRUE if n is in row y */ unsigned char *col; /* o^2: col[x*cr+n-1] TRUE if n is in col x */ + +#ifdef STANDALONE_SOLVER + char **names; /* o: names[n-1] gives name of 'digit' n */ +#endif }; #define cubepos(x,y,n) (((x)*solver->o+(y))*solver->o+(n)-1) #define cube(x,y,n) (solver->cube[cubepos(x,y,n)]) @@ -26,14 +30,6 @@ struct latin_solver { #define gridpos(x,y) ((y)*solver->o+(x)) #define grid(x,y) (solver->grid[gridpos(x,y)]) -/* A solo solver using this code would need these defined. See solo.c. */ -#ifndef YTRANS -#define YTRANS(y) (y) -#endif -#ifndef YUNTRANS -#define YUNTRANS(y) (y) -#endif - /* --- Solver individual strategies --- */ @@ -116,6 +112,9 @@ void latin_solver_debug(unsigned char *cube, int o); digit *latin_generate(int o, random_state *rs); +/* The order of the latin rectangle is max(w,h). */ +digit *latin_generate_rect(int w, int h, random_state *rs); + int latin_check(digit *sq, int order); /* !0 => not a latin square */ void latin_debug(digit *sq, int order);