fine tune wordsearch

This commit is contained in:
samerbam 2023-08-22 23:08:19 -04:00
parent 42c91d2ceb
commit 1571db0a35
2 changed files with 26 additions and 8 deletions

View File

@ -95,13 +95,13 @@ class ThermalPrinter():
def print_wordsearch(self): def print_wordsearch(self):
# words = ("gugu,gaga") # words = ("gugu,gaga")
r = RandomWord() r = RandomWord()
words = r.random_words(10, include_parts_of_speech=["nouns", "verbs", "adjectives"]) words = r.random_words(15, include_parts_of_speech=["nouns", "verbs", "adjectives"])
w = WordSearch(','.join(words), 32, 32) w = WordSearch(','.join(words), 32, 16)
for x in w.grid: for x in w.grid:
self.p.set(align="center") self.p.set(align="center")
self.p.text(x + "\n") self.p.text(''.join(x) + "\n")
# Defaults.NOUNS: Represents a list of nouns # Defaults.NOUNS: Represents a list of nouns
# Defaults.VERBS: Represents a list of verbs # Defaults.VERBS: Represents a list of verbs

View File

@ -201,13 +201,31 @@ class WordSearch():
# Test Progamm for WordSearch Genertator # Test Progamm for WordSearch Genertator
if __name__ == '__main__': if __name__ == '__main__':
words = ("gugu,gaga") # words = ("gugu,gaga")
w = WordSearch(words, 10, 5) # w = WordSearch(words, 10, 5)
# def printGrid(grid):
# for row in grid:
# for column in row:
# print("%s" % column, end='')
# print()
# printGrid(w.grid)
# w.findWords(words.split(','))
# print(w.wordPosition)
from wonderwords import RandomWord
r = RandomWord()
words = r.random_words(15, include_parts_of_speech=["nouns", "verbs", "adjectives"])
w = WordSearch(','.join(words), 32, 16)
print(words)
def printGrid(grid): def printGrid(grid):
for row in grid: for row in grid:
for column in row: for column in row:
print("%s" % column, end='') print("%s" % column, end='')
print() print()
printGrid(w.grid) printGrid(w.grid)
w.findWords(words.split(',')) # print(w.grid)
# w.findWords(words.split(','))
print(w.wordPosition) print(w.wordPosition)