def puzzle_gen():
    global table, WORDS
    WORDS = ['cat', 'bear', 'tiger', 'lion']
    table = [['0' for i in range(10)] for i in range(10)]
    result = create_panel(height=10, width=10, words_value_list=WORDS)

    display_panel(result.get('panel'))
    #convert into 2d array
    for i in range(0, 10):
        for j in range(0, 10):
            table[i][j] = result.get('panel').cells[i, j]
Ejemplo n.º 2
0
def puzzle_gen():
    global words, table
    words = ['cat', 'bear', 'tiger', 'lion']
    table = [['0' for i in range(5)] for i in range(5)]
    result = create_panel(height=5, width=5, words_value_list=words)

    display_panel(result.get('panel'))
    #convert into 2d array
    for i in range(0, 5):
        for j in range(0, 5):
            table[i][j] = result.get('panel').cells[i, j]
Ejemplo n.º 3
0
def crear_sopa():
    words = [E2.get(), E3.get(), E4.get(), E5.get(), E6.get()]
    ndim = int(E1.get())
    result = create_panel(height=ndim, width=ndim, words_value_list=words,
                          as_dict=TRUE)  # , as_dict=TRUE
    with open('SopaLetras.txt', 'w') as outfile:
        json.dump(result, outfile)
    #
    # display_panel(result.get('panel'))
    # S2.insert(tk.END, r)
    with open('SopaLetras.txt', 'r') as inside:
        data = json.load(inside)
        data1 = json.dumps(data, indent=4, sort_keys=TRUE)
    S2.insert('1.0', str(data1))
    S2.config(state=DISABLED)
Ejemplo n.º 4
0
def handler(event, context):
    print(event)
    text = event.get("text")
    maxwords = int(event.get("maxwords"))
    width = event.get("width")
    height = event.get('height')
    rake = RAKE.Rake(RAKE.SmartStopList())
    phraseList = rake.run(text, maxWords=1, minFrequency=1)
    print(phraseList)
    phraseListLen = len(phraseList)
    if phraseListLen < maxwords:
        maxwords = phraseListLen
    slicedTuples = phraseList[:maxwords]
    sliced = [x[0] for x in slicedTuples]
    result = create_panel(height=15, width=15, words_value_list=sliced)
    return {
        "result": print_panel(result.get('panel')),
        "words": sliced,
    }
Ejemplo n.º 5
0
 def crear_sopa(self):
     words = [self.entry2.get(), self.entry3.get(), self.entry4.get(), self.entry5.get(), self.entry6.get()]
     ndim = int(self.entry1.get())
     result = create_panel(height=ndim, width=ndim, words_value_list=words)
     print(display_panel(result.get('panel')))
     self.S2.config(state=DISABLED)
Ejemplo n.º 6
0
import time

from word_search_puzzle.utils import display_panel
from word_search_puzzle.algorithms import create_panel

words = ['cat', 'dog', 'tiger', 'lion']

table = [['0' for i in range(10)] for i in range(10)]
result = create_panel(height=10, width=10, words_value_list=words)
position = ""
import math

# print('Attempts: {}'.format(result.get('attempts')))
# print('Solution took: {} ms'.format(result.get('elapsed_time')))
display_panel(result.get('panel'))
#print(result.get('panel').cells[0,0])
#print(type(result.get('panel')))

for i in range(0, 10):
    for j in range(0, 10):
        table[i][j] = result.get('panel').cells[i, j]


#
# #print(table[0][0])
# print()
def DFS(row, column, string):
    print("NorthEast:\n", end="")
    DFSsearch(row, column, string, 'NorthEast')
    print("East:\n", end="")
    DFSsearch(row, column, string, 'East')