From bf22862ffa0bfaadab99f824f8bb6051fc571394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20S=2E=20Martins?= Date: Wed, 18 May 2016 19:40:52 +0100 Subject: [PATCH] Fix a bug where the words would be "stuck" to each other end-to-end. --- crossword_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crossword_generator.py b/crossword_generator.py index 8af0011..c06664c 100755 --- a/crossword_generator.py +++ b/crossword_generator.py @@ -83,14 +83,14 @@ def is_valid(possibility, grid): if j > 0 and grid[i][j-1] != 0: return False # If the succeding space isn't empy - if j+len(word) < len(grid[0])-1 and grid[i][j+len(word)+1] != 0: + if j+len(word) < len(grid[0])-1 and grid[i][j+len(word)] != 0: return False if D is "S": # If the preceding space isn't empty if i > 0 and grid[i-1][j] != 0: return False # If the succeding space isn't empy - if i+len(word) < len(grid)-1 and grid[i+len(word)+1][j] != 0: + if i+len(word) < len(grid)-1 and grid[i+len(word)][j] != 0: return False # If we can't find any collisions, it must be okay!