-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.py
27 lines (22 loc) · 794 Bytes
/
block.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
class Block:
def __init__(self, type_of_block):
self.type_of_block = type_of_block
self.cells = []
self.number_possible_cells_map = [[], [], [], [], [], [], [], [], []]
def add_cell(self, cell):
self.cells.append(cell)
for possible_cells in self.number_possible_cells_map:
possible_cells.append(cell)
def reset(self):
self.number_possible_cells_map = [[], [], [], [], [], [], [], [], []]
for c in self.cells:
for possible_cells in self.number_possible_cells_map:
possible_cells.append(c)
def __repr__(self):
s = ""
for i in range(9):
if i % 3 == 0:
s += "\t"
s += self.cells[i].pretty()
s += "\n"
return s