chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix an edge case of divider-obsoletion in Group.
[sgt-puzzles.git]
/
unfinished
/
group.c
diff --git
a/unfinished/group.c
b/unfinished/group.c
index 74a63fc2a04a19be7bd5b3be83af550bcee9fde5..c3033264258fcef28d51f09b6040a039f37502de 100644
(file)
--- a/
unfinished/group.c
+++ b/
unfinished/group.c
@@
-1430,8
+1430,9
@@
static game_state *execute_move(const game_state *from, const char *move)
/*
* Eliminate any obsoleted dividers.
*/
/*
* Eliminate any obsoleted dividers.
*/
- for (x = 0; x+1 < w; x++) {
- int i = ret->sequence[x], j = ret->sequence[x+1];
+ for (x = 0; x < w; x++) {
+ int i = ret->sequence[x];
+ int j = (x+1 < w ? ret->sequence[x+1] : -1);
if (ret->dividers[i] != j)
ret->dividers[i] = -1;
}
if (ret->dividers[i] != j)
ret->dividers[i] = -1;
}