-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cell.py
50 lines (41 loc) · 1.1 KB
/
Cell.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
40
41
42
43
44
45
46
47
48
49
50
NORMAL = 'normal'
ENABLED = 'enabled'
DISABLED = 'disabled'
class Cell:
"""
Cell class represents each cell in the grid.
"""
def __init__(self, value, solution):
self.value = value
self.solution = solution
self.state = NORMAL
def reset(self):
"""
Reset the cell to its initial state which is normal.
"""
self.state = NORMAL
def enable(self):
"""
Enable the cell.
"""
self.state = ENABLED
def disable(self):
"""
Disable the cell.
"""
self.state = DISABLED
def is_disabled(self):
"""
Return True if the cell is disabled. Otherwise, return False.
"""
return self.state == DISABLED
def is_enabled(self):
"""
Return True if the cell is enabled. Otherwise, return False.
"""
return self.state == ENABLED
def is_normal(self):
"""
Return True if the cell is normal. Otherwise, return False.
"""
return self.state == NORMAL