Fix bug loading duplicate wordlist for multi-letter blocks

This commit is contained in:
2022-09-07 10:28:12 -04:00
parent 795f1540b4
commit cdb1542184
+8 -4
View File
@@ -386,11 +386,15 @@ def build_full_boggle_tree(board: BoggleBoard, wordlist_path: str) -> dict[str,
index = {} index = {}
print("Reading in wordlists...") print("Reading in wordlists...")
for letter in alphabet: for letters in alphabet:
filename = "words_" + letter[0] + ".txt" if letters[0] in index:
print(f">> {letter}: {filename}") index[letters] = index[letters[0]]
continue
filename = "words_" + letters[0] + ".txt"
print(f">> {letters}: {filename}")
wordlist = read_wordlist(path.join(path.abspath(wordlist_path), filename)) wordlist = read_wordlist(path.join(path.abspath(wordlist_path), filename))
index[letter] = wordlist index[letters] = wordlist
print("Generating WordTrees...") print("Generating WordTrees...")
params = [ [alphabet, board, cell, index[cell.letters] ] for cell in board.board.values()] params = [ [alphabet, board, cell, index[cell.letters] ] for cell in board.board.values()]