-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathword_search_controller.py
39 lines (31 loc) · 1.21 KB
/
word_search_controller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import word_search_model as model
class Logic(object):
"""Class representing the word search solver controller.
Attributes:
grid: List of lists representing the word search grid.
words_to_find: Dictionary with key representing a word to be found in
word search grid and value representing the location of the word's
first character.
"""
def __init__(self):
"""Constructor for Logic object."""
self.grid = None
self.words_to_find = None
def set_grid(self, grid):
"""Setter for grid attribute.
Args:
grid: List of lists representing the word search grid.
"""
self.grid = grid
def set_words_to_find(self, words_to_find):
"""Setter for words_to_find attribute.
Args:
words_to_find: Dictionary with key representing a word to be found
in word search grid and value representing the location of the
word's first character.
"""
self.words_to_find = words_to_find
def solve(self):
"""Call word search solver model to solve word search."""
result = model.solve(self.grid, self.words_to_find)
return result