确保boss和lock只能在路径上生成
This commit is contained in:
parent
b88edf5d84
commit
e5b6011d41
@ -19,15 +19,21 @@ class SourceCollector:
|
||||
self.end_pos = None
|
||||
self.path = []
|
||||
self.node_path = []
|
||||
self.boss_pos = None
|
||||
self.lock_pos = None
|
||||
if self.filename:
|
||||
self.maze = []
|
||||
with open(f"{self.filename}",'r') as f:
|
||||
reader = csv.reader(f)
|
||||
for row in reader:
|
||||
for idx,row in enumerate(reader):
|
||||
t = []
|
||||
for i in row:
|
||||
if i.startswith('b') or i.startswith('l'):
|
||||
for idy,i in enumerate(row):
|
||||
if i.startswith('b'):
|
||||
t.append('0')
|
||||
self.boss_pos = (idx,idy)
|
||||
elif i.startswith('l'):
|
||||
t.append('0')
|
||||
self.lock_pos = (idx,idy)
|
||||
else:
|
||||
t.append(i)
|
||||
self.maze.append(t)
|
||||
@ -142,7 +148,7 @@ class SourceCollector:
|
||||
children = sn.children[:]
|
||||
for child in children:
|
||||
self.dfs(child)
|
||||
|
||||
if self.colNums < 11:
|
||||
children.sort(key=lambda c: len(c.path))
|
||||
cur = None
|
||||
for idx, child in enumerate(children):
|
||||
@ -204,10 +210,7 @@ class SourceCollector:
|
||||
if item == self.path[idx-1]:
|
||||
del self.path[idx]
|
||||
|
||||
if self.path and self.end_pos and self.path[-1] != self.end_pos:
|
||||
bfs_tail = self.bfs_path(self.path[-1], self.end_pos)
|
||||
if bfs_tail:
|
||||
self.path.extend(bfs_tail[1:])
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user