-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cell.py
42 lines (35 loc) · 900 Bytes
/
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
import chalk
class Cell():
row = 0
column = 0
start = False
visited = False
value = 0
current = False
walls = {
'north': True,
'east': True,
'south': True,
'west': True
}
def __init__(self, row, column):
self.row = row
self.column = column
self.visited = False
def __str__(self):
cell = "[{0:03d}] ".format(self.value)
if self.start:
return chalk.green(cell)
elif self.current:
return chalk.red(cell)
elif self.visited:
return chalk.yellow(cell)
return cell
def set_current(self, value):
self.current = value
def set_value(self, value):
self.value = value
def set_walls(self, walls):
self.walls.update(walls)
def get_coordinates(self):
return [self.row, self.column]