From c0c8f264e2d488a6f726add0a27e2876c14e6f34 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 11 Sep 2005 18:05:23 +0000 Subject: [PATCH] Minor improvement to initial loop generation. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6292 cda61777-01e9-0310-a592-d414129be87e --- loopy.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); -- 2.11.0