Hi. I need help with this level, I start it but now don’t know how to do, this is my code:
(Hola. Necesito ayuda en este nivel, lo empecé pero ahora no sé que hacer, este es mi código):
inSearch = True
width = 19
height = 15
def coorConvert(i, dist):
return i * 8 + 10
wall = "X"
unknown = "?"
empty = "."
# Clear map of the maze.
maze = []
# left border
for i in range(height):
maze.append([wall])
# top border
for j in range(width - 1):
maze[0].append(wall)
for i in range(height - 1):
if i % 2:
for j in range(width - 1):
maze[i].append(unknown)
else:
for j in range(width - 1):
if j % 2:
maze[i].append(wall)
else:
maze[i].append(unknown)
# bottom border
for j in range(width - 1):
maze[height-1].append(wall)
# right border
for i in range(height):
maze.append([wall])
# Start position
hero.row = 13
hero.col = 17
# Exit
exitRow = 13
exitCol = 17
item = hero.findNearest(hero.findItems())
distance = 16
move = Vector(distance, 0)
direction = Vector.add(move, hero.pos)
while True:
while not (hero.isPathClear(hero.pos, direction)):
move = Vector.rotate(move, Math.PI / 2)
direction = Vector.add(move, hero.pos)
# hero.say(direction)
hero.moveXY(direction.x, direction.y)
move = Vector.rotate(move, -Math.PI / 2)
direction = Vector.add(move, hero.pos)