aboutsummaryrefslogtreecommitdiff
path: root/loopy.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-09-11 18:05:23 +0000
committerSimon Tatham <anakin@pobox.com>2005-09-11 18:05:23 +0000
commitf71630073f1abbcb16f65807846cdeb608163a70 (patch)
treede02088d193e1a9a1e52e389a2a43dc54393f3b2 /loopy.c
parent6bbcf248aa79799be8468542dbb147b546aeb640 (diff)
downloadpuzzles-f71630073f1abbcb16f65807846cdeb608163a70.zip
puzzles-f71630073f1abbcb16f65807846cdeb608163a70.tar.gz
puzzles-f71630073f1abbcb16f65807846cdeb608163a70.tar.bz2
puzzles-f71630073f1abbcb16f65807846cdeb608163a70.tar.xz
Minor improvement to initial loop generation.
[originally from svn r6292]
Diffstat (limited to 'loopy.c')
-rw-r--r--loopy.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/loopy.c b/loopy.c
index f4d3e6a..42e7856 100644
--- a/loopy.c
+++ b/loopy.c
@@ -764,7 +764,16 @@ static char *new_fullyclued_board(game_params *params, random_state *rs)
square = (struct square *)index234(lightable_squares_sorted, 0);
assert(square);
- if (square->score <= 0)
+ /*
+ * We never want to _decrease_ the loop's perimeter. Making
+ * moves that leave the perimeter the same is occasionally
+ * useful: if it were _never_ done then the user would be
+ * able to deduce illicitly that any degree-zero vertex was
+ * on the outside of the loop. So we do it sometimes but
+ * not always.
+ */
+ if (square->score < 0 || (square->score == 0 &&
+ random_upto(rs, 2) == 0))
break;
print_tree(lightable_squares_sorted);