From aadf0fa1912e8976efa5e0b789d62ed71fff0188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20S=2E=20Martins?= Date: Wed, 18 May 2016 13:20:40 +0100 Subject: [PATCH] Minor tweaks to parameters and screen output. --- crossword_generator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crossword_generator.py b/crossword_generator.py index 3c44113..92fdb24 100755 --- a/crossword_generator.py +++ b/crossword_generator.py @@ -187,7 +187,7 @@ def generate_grid(words, dim): # Fill in grid occupancy = 0 - while occupancy < 0.5 and possibilities: + while occupancy < 0.75 and possibilities: # Add new possibility new = possibilities.pop(random.randint(0, len(possibilities)-1)) @@ -215,7 +215,8 @@ def generate_grid(words, dim): occupancy = 1 - (sum(x.count(0) for x in grid) / (dim[0]*dim[1])) #print("Occupancy: {}.".format(occupancy)) - # ... and return the grid + # Report and return the grid + print("Build a grid of occupancy {}.".format(occupancy)) return {"grid": grid, "words": added_words} def write_grid(grid, screen=False, out_file="table.tex", words=[]):