-
Notifications
You must be signed in to change notification settings - Fork 0
/
newIsland.py
64 lines (48 loc) · 1.72 KB
/
newIsland.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
51
52
53
54
55
56
57
58
59
60
61
62
class FindIslands:
row1 = list()
row2 = list()
row3 = list()
row4 = list()
row5 = list()
matrix = list()
def makeMatrix(self):
global row1
row1 = ([1, 1, 'o', 0], [1, 2, 'o', 0], [1, 3, 'o', 0], [1, 4, 'o', 0], [1, 5, 'o', 0])
global row2
row2 = ([2, 1, 'x', 0], [2, 2, 'x', 0], [2, 3, 'o', 0], [2, 4, 'o', 0], [2, 5, 'o', 0])
global row3
row3 = ([3, 1, 'o', 0], [3, 2, 'x', 0], [3, 3, 'o', 0], [3, 4, 'o', 0], [3, 5, 'o', 0])
global row4
row4 = ([4, 1, 'o', 0], [4, 2, 'o', 0], [4, 3, 'o', 0], [4, 4, 'o', 0], [4, 5, 'o', 0])
global row5
row5 = ([5, 1, 'o', 0], [5, 2, 'o', 0], [5, 3, 'o', 0], [5, 4, 'o', 0], [5, 5, 'o', 0])
global matrix
matrix = (row1, row2, row3, row4, row5)
# o o o o o
# x x o o o
# o x o o o
# o o o o o
def testZip(self):
zipped0 = zip(row1, row2)
for item in zipped0:
print(item)
print("--------------------------------")
zipped1 = zip(row2, row3)
for item in zipped1:
print(item)
print("--------------------------------")
zipped2 = zip(row3, row4)
for item in zipped2:
print(item)
print("--------------------------------")
zipped3 = zip(row4, row5)
for item in zipped3:
print(item)
print("--------------------------------")
zipped4 = zip(row1, row2, row3, row4, row5)
for item in zipped4:
print(item)
print("--------------------------------")
findIslands = FindIslands()
findIslands.makeMatrix()
findIslands.testZip()