From 5849513fb597a1e696dfcd1f82bc42948ec53dbd Mon Sep 17 00:00:00 2001 From: boboquack Date: Tue, 25 Jan 2022 17:21:37 +1100 Subject: [PATCH] Fixed issue with derivedwords Stops an error if a derivedword wasn't actually in the wordlist Changing derivedwords to look like ``` def derivedwords(word): return {word,word+'s'}|({word[:-1]} if word[-1]=='s' else set()) ``` should now run without errors --- src/backend/lib/checked_board_gen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/lib/checked_board_gen.py b/src/backend/lib/checked_board_gen.py index cd3ef3b..5aff944 100644 --- a/src/backend/lib/checked_board_gen.py +++ b/src/backend/lib/checked_board_gen.py @@ -473,8 +473,7 @@ def create_board(mainword,words,maxheight=20,maxwidth=20,maxretries=1000): for loc,data in zip(locs,fill): word,displacement=data - for i in derivedwords(word): - words.remove(i) + words-=derivedwords(word) r,c,dir=loc if dir=='a': grid.add_word(word,r,c-displacement,dir)