aboutsummaryrefslogtreecommitdiff
path: root/latin.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-11-13 21:44:02 +0000
committerSimon Tatham <anakin@pobox.com>2018-11-13 21:48:24 +0000
commita550ea0a47374705a37f36b0f05ffe9e4c8161fb (patch)
treea4664ac4d90cdeb581ddd2bf41ccda7b0d45855c /latin.c
parent064da876828ea3079d5d7be5849b693f4d55364b (diff)
downloadpuzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.zip
puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.tar.gz
puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.tar.bz2
puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.tar.xz
Replace TRUE/FALSE with C99 true/false throughout.
This commit removes the old #defines of TRUE and FALSE from puzzles.h, and does a mechanical search-and-replace throughout the code to replace them with the C99 standard lowercase spellings.
Diffstat (limited to 'latin.c')
-rw-r--r--latin.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/latin.c b/latin.c
index 3865ad1..c843671 100644
--- a/latin.c
+++ b/latin.c
@@ -43,21 +43,21 @@ void latin_solver_place(struct latin_solver *solver, int x, int y, int n)
*/
for (i = 1; i <= o; i++)
if (i != n)
- cube(x,y,i) = FALSE;
+ cube(x,y,i) = false;
/*
* Rule out this number in all other positions in the row.
*/
for (i = 0; i < o; i++)
if (i != y)
- cube(x,i,n) = FALSE;
+ cube(x,i,n) = false;
/*
* Rule out this number in all other positions in the column.
*/
for (i = 0; i < o; i++)
if (i != x)
- cube(i,y,n) = FALSE;
+ cube(i,y,n) = false;
/*
* Enter the number in the result grid.
@@ -68,7 +68,7 @@ void latin_solver_place(struct latin_solver *solver, int x, int y, int n)
* Cross out this number from the list of numbers left to place
* in its row, its column and its block.
*/
- solver->row[y*o+n-1] = solver->col[x*o+n-1] = TRUE;
+ solver->row[y*o+n-1] = solver->col[x*o+n-1] = true;
}
int latin_solver_elim(struct latin_solver *solver, int start, int step
@@ -170,8 +170,8 @@ int latin_solver_set(struct latin_solver *solver,
* any row with a solitary 1 - and discarding that row and the
* column containing the 1.
*/
- memset(rowidx, TRUE, o);
- memset(colidx, TRUE, o);
+ memset(rowidx, true, o);
+ memset(colidx, true, o);
for (i = 0; i < o; i++) {
int count = 0, first = -1;
for (j = 0; j < o; j++)
@@ -180,7 +180,7 @@ int latin_solver_set(struct latin_solver *solver,
if (count == 0) return -1;
if (count == 1)
- rowidx[i] = colidx[first] = FALSE;
+ rowidx[i] = colidx[first] = false;
}
/*
@@ -226,10 +226,10 @@ int latin_solver_set(struct latin_solver *solver,
*/
int rows = 0;
for (i = 0; i < n; i++) {
- int ok = TRUE;
+ int ok = true;
for (j = 0; j < n; j++)
if (set[j] && grid[i*o+j]) {
- ok = FALSE;
+ ok = false;
break;
}
if (ok)
@@ -261,7 +261,7 @@ int latin_solver_set(struct latin_solver *solver,
}
if (rows >= n - count) {
- int progress = FALSE;
+ int progress = false;
/*
* We've got one! Now, for each row which _doesn't_
@@ -275,10 +275,10 @@ int latin_solver_set(struct latin_solver *solver,
* positions in the cube to meddle with.
*/
for (i = 0; i < n; i++) {
- int ok = TRUE;
+ int ok = true;
for (j = 0; j < n; j++)
if (set[j] && grid[i*o+j]) {
- ok = FALSE;
+ ok = false;
break;
}
if (!ok) {
@@ -310,8 +310,8 @@ int latin_solver_set(struct latin_solver *solver,
names[pn-1], px+1, py+1);
}
#endif
- progress = TRUE;
- solver->cube[fpos] = FALSE;
+ progress = true;
+ solver->cube[fpos] = false;
}
}
}
@@ -522,7 +522,7 @@ int latin_solver_forcing(struct latin_solver *solver,
xt+1, yt+1);
}
#endif
- cube(xt, yt, orign) = FALSE;
+ cube(xt, yt, orign) = false;
return 1;
}
}
@@ -570,12 +570,12 @@ void latin_solver_alloc(struct latin_solver *solver, digit *grid, int o)
solver->o = o;
solver->cube = snewn(o*o*o, unsigned char);
solver->grid = grid; /* write straight back to the input */
- memset(solver->cube, TRUE, o*o*o);
+ memset(solver->cube, true, o*o*o);
solver->row = snewn(o*o, unsigned char);
solver->col = snewn(o*o, unsigned char);
- memset(solver->row, FALSE, o*o);
- memset(solver->col, FALSE, o*o);
+ memset(solver->row, false, o*o);
+ memset(solver->col, false, o*o);
for (x = 0; x < o; x++)
for (y = 0; y < o; y++)