ref: 771f5446a8c81584bc2d700e0f991eb727b85b9e
parent: 056465cb03a9753020014529531b348e231898ba
author: Simon Tatham <anakin@pobox.com>
date: Mon Jan 11 15:32:55 EST 2010
Retire the YTRANS and YUNTRANS macros in latin.[ch]. They were introduced to mimic similar macros in solo.c, in case Solo ever moved over to being based on the latin.c solver framework; but even Solo has long since lost those macros, so latin.c has no need to keep them. [originally from svn r8827]
--- a/latin.c
+++ b/latin.c
@@ -62,7 +62,7 @@
/*
* Enter the number in the result grid.
*/
- solver->grid[YUNTRANS(y)*o+x] = n;
+ solver->grid[y*o+x] = n;
/*
* Cross out this number from the list of numbers left to place
@@ -104,7 +104,7 @@
x = y / o;
y %= o;
- if (!solver->grid[YUNTRANS(y)*o+x]) {
+ if (!solver->grid[y*o+x]) {
#ifdef STANDALONE_SOLVER
if (solver_show_working) {
va_list ap;
@@ -114,7 +114,7 @@
va_end(ap);
printf(":\n%*s placing %s at (%d,%d)\n",
solver_recurse_depth*4, "", names[n-1],
- x+1, YUNTRANS(y)+1);
+ x+1, y+1);
}
#endif
latin_solver_place(solver, x, y, n);
@@ -307,7 +307,7 @@
printf("%*s ruling out %s at (%d,%d)\n",
solver_recurse_depth*4, "",
- names[pn-1], px+1, YUNTRANS(py)+1);
+ names[pn-1], px+1, py+1);
}
#endif
progress = TRUE;
@@ -508,7 +508,7 @@
yl = yy;
while (1) {
printf("%s(%d,%d)", sep, xl+1,
- YUNTRANS(yl)+1);
+ yl+1);
xl = bfsprev[yl*o+xl];
if (xl < 0)
break;
@@ -519,7 +519,7 @@
printf("\n%*s ruling out %s at (%d,%d)\n",
solver_recurse_depth*4, "",
names[orign-1],
- xt+1, YUNTRANS(yt)+1);
+ xt+1, yt+1);
}
#endif
cube(xt, yt, orign) = FALSE;
@@ -580,7 +580,7 @@
for (x = 0; x < o; x++)
for (y = 0; y < o; y++)
if (grid[y*o+x])
- latin_solver_place(solver, x, YTRANS(y), grid[y*o+x]);
+ latin_solver_place(solver, x, y, grid[y*o+x]);
#ifdef STANDALONE_SOLVER
solver->names = NULL;
@@ -611,7 +611,7 @@
#ifdef STANDALONE_SOLVER
, "positional elimination,"
" %s in row %d", names[n-1],
- YUNTRANS(y)+1
+ y+1
#endif
);
if (ret != 0) return ret;
@@ -636,11 +636,11 @@
*/
for (x = 0; x < o; x++)
for (y = 0; y < o; y++)
- if (!solver->grid[YUNTRANS(y)*o+x]) {
+ if (!solver->grid[y*o+x]) {
ret = latin_solver_elim(solver, cubepos(x,y,1), 1
#ifdef STANDALONE_SOLVER
, "numeric elimination at (%d,%d)",
- x+1, YUNTRANS(y)+1
+ x+1, y+1
#endif
);
if (ret != 0) return ret;
@@ -664,7 +664,7 @@
for (y = 0; y < o; y++) {
ret = latin_solver_set(solver, scratch, cubepos(0,y,1), o*o, 1
#ifdef STANDALONE_SOLVER
- , "set elimination, row %d", YUNTRANS(y)+1
+ , "set elimination, row %d", y+1
#endif
);
if (ret != 0) return ret;
@@ -734,7 +734,7 @@
*/
count = 0;
for (n = 1; n <= o; n++)
- if (cube(x,YTRANS(y),n))
+ if (cube(x,y,n))
count++;
/*
@@ -770,7 +770,7 @@
/* Make a list of the possible digits. */
for (j = 0, n = 1; n <= o; n++)
- if (cube(x,YTRANS(y),n))
+ if (cube(x,y,n))
list[j++] = n;
#ifdef STANDALONE_SOLVER
--- a/latin.h
+++ b/latin.h
@@ -30,14 +30,6 @@
#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 --- */