ref: f71630073f1abbcb16f65807846cdeb608163a70
parent: 6bbcf248aa79799be8468542dbb147b546aeb640
author: Simon Tatham <anakin@pobox.com>
date: Sun Sep 11 14:05:23 EDT 2005
Minor improvement to initial loop generation. [originally from svn r6292]
--- a/loopy.c
+++ b/loopy.c
@@ -764,7 +764,16 @@
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);