From d7538915a57dfd13a1bb258896ef9e0f481223fa Mon Sep 17 00:00:00 2001 From: Kyungwon Chun Date: Mon, 2 Oct 2023 09:03:07 +0000 Subject: [PATCH] Update word_search.py Fix the conditional to check the valid location of the diagonal towards the bottom left. --- Chapter3/word_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter3/word_search.py b/Chapter3/word_search.py index c6a6085..9606c0f 100644 --- a/Chapter3/word_search.py +++ b/Chapter3/word_search.py @@ -55,7 +55,7 @@ def generate_domain(word: str, grid: Grid) -> List[List[GridLocation]]: # top to bottom domain.append([GridLocation(r, col) for r in rows]) # diagonal towards bottom left - if col - length >= 0: + if col + 1 - length >= 0: domain.append([GridLocation(r, col - (r - row)) for r in rows]) return domain