mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Keen: fix another misuse of dsf_canonify.
Chris Boyle points out that outline_block_structure has a comment saying that we're supposed to have picked a square with a boundary to its left. dsf_canonify no longer guarantees that, but dsf_minimal does. Switch to using that throughout the function. 'keen --generate 10#12345 --print 5x2' failed an assertion before this fix, and now doesn't.
This commit is contained in:
10
keen.c
10
keen.c
@ -2257,7 +2257,7 @@ static void outline_block_structure(drawing *dr, game_drawstate *ds,
|
|||||||
* Iterate over all the blocks.
|
* Iterate over all the blocks.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < a; i++) {
|
for (i = 0; i < a; i++) {
|
||||||
if (dsf_canonify(dsf, i) != i)
|
if (dsf_minimal(dsf, i) != i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2296,11 +2296,11 @@ static void outline_block_structure(drawing *dr, game_drawstate *ds,
|
|||||||
tx = x - dy + dx;
|
tx = x - dy + dx;
|
||||||
ty = y + dx + dy;
|
ty = y + dx + dy;
|
||||||
nin += (tx >= 0 && tx < w && ty >= 0 && ty < w &&
|
nin += (tx >= 0 && tx < w && ty >= 0 && ty < w &&
|
||||||
dsf_canonify(dsf, ty*w+tx) == i);
|
dsf_minimal(dsf, ty*w+tx) == i);
|
||||||
tx = x - dy;
|
tx = x - dy;
|
||||||
ty = y + dx;
|
ty = y + dx;
|
||||||
nin += (tx >= 0 && tx < w && ty >= 0 && ty < w &&
|
nin += (tx >= 0 && tx < w && ty >= 0 && ty < w &&
|
||||||
dsf_canonify(dsf, ty*w+tx) == i);
|
dsf_minimal(dsf, ty*w+tx) == i);
|
||||||
if (nin == 0) {
|
if (nin == 0) {
|
||||||
/*
|
/*
|
||||||
* Turn right.
|
* Turn right.
|
||||||
@ -2337,9 +2337,9 @@ static void outline_block_structure(drawing *dr, game_drawstate *ds,
|
|||||||
* somewhere sensible.
|
* somewhere sensible.
|
||||||
*/
|
*/
|
||||||
assert(x >= 0 && x < w && y >= 0 && y < w &&
|
assert(x >= 0 && x < w && y >= 0 && y < w &&
|
||||||
dsf_canonify(dsf, y*w+x) == i);
|
dsf_minimal(dsf, y*w+x) == i);
|
||||||
assert(x+dx < 0 || x+dx >= w || y+dy < 0 || y+dy >= w ||
|
assert(x+dx < 0 || x+dx >= w || y+dy < 0 || y+dy >= w ||
|
||||||
dsf_canonify(dsf, (y+dy)*w+(x+dx)) != i);
|
dsf_minimal(dsf, (y+dy)*w+(x+dx)) != i);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Record the point we just went past at one end of the
|
* Record the point we just went past at one end of the
|
||||||
|
Reference in New Issue
Block a user