-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelAnalyser.py
89 lines (60 loc) · 2.17 KB
/
LevelAnalyser.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
from config import config
from fileUtil import readLevel
class LevelAnalyser:
def getWallCount(self, level):
count = 0
for y in level:
for x in y:
if x == config.get().get("defined").get("wall"):
count += 1
return count
def getWallPositions(self, level):
positions = []
for y in range(len(level)):
for x in range(len(level[y])):
if level[y][x] == config.get().get("defined").get("wall"):
positions.append((x, y))
return positions
def getEmptyCount(self, level):
count = 0
for y in level:
for x in y:
if x == config.get().get("defined").get("nothing"):
count += 1
return count
def getEmptyPositions(self, level):
positions = []
for y in range(len(level)):
for x in range(len(level[y])):
if level[y][x] == config.get().get("defined").get("nothing"):
positions.append((x, y))
return positions
def getLightSourceCount(self, level):
count = 0
for y in level:
for x in y:
if x == config.get().get("defined").get("lightSource"):
count += 1
return count
def getLightSourcePositions(self, level):
positions = []
for y in range(len(level)):
for x in range(len(level[y])):
if level[y][x] == config.getDefined().get("lightSource"):
positions.append([x, y])
return positions
def getTempLightSourceCount(self, level):
count = 0
for y in level:
for x in y:
if x == config.get().get("defined").get("tempLightSource"):
count += 1
return count
def getTempLightSourcePositions(self, level):
positions = []
for y in range(len(level)):
for x in range(len(level[y])):
if level[y][x] == config.getDefined().get("tempLightSource"):
positions.append([x, y])
return positions
levelAnalyser = LevelAnalyser()