From 1571db0a35d93bfa6a28c1fa790659283fc94e96 Mon Sep 17 00:00:00 2001 From: samerbam Date: Tue, 22 Aug 2023 23:08:19 -0400 Subject: [PATCH] fine tune wordsearch --- application/thermal_print.py | 8 ++++---- application/wordsearch_generator.py | 26 ++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/application/thermal_print.py b/application/thermal_print.py index 8eebf38..bf580bc 100644 --- a/application/thermal_print.py +++ b/application/thermal_print.py @@ -95,13 +95,13 @@ class ThermalPrinter(): def print_wordsearch(self): # words = ("gugu,gaga") - r = RandomWord() - words = r.random_words(10, include_parts_of_speech=["nouns", "verbs", "adjectives"]) - w = WordSearch(','.join(words), 32, 32) + r = RandomWord() + words = r.random_words(15, include_parts_of_speech=["nouns", "verbs", "adjectives"]) + w = WordSearch(','.join(words), 32, 16) for x in w.grid: self.p.set(align="center") - self.p.text(x + "\n") + self.p.text(''.join(x) + "\n") # Defaults.NOUNS: Represents a list of nouns # Defaults.VERBS: Represents a list of verbs diff --git a/application/wordsearch_generator.py b/application/wordsearch_generator.py index 08d528b..ea05334 100644 --- a/application/wordsearch_generator.py +++ b/application/wordsearch_generator.py @@ -201,13 +201,31 @@ class WordSearch(): # Test Progamm for WordSearch Genertator if __name__ == '__main__': - words = ("gugu,gaga") - w = WordSearch(words, 10, 5) + # words = ("gugu,gaga") + # 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): for row in grid: for column in row: print("%s" % column, end='') print() printGrid(w.grid) - w.findWords(words.split(',')) - print(w.wordPosition) \ No newline at end of file + # print(w.grid) + # w.findWords(words.split(',')) + print(w.wordPosition)