Escaping the Maze
November 25, 2020•101 words
Python bootcamp #100DaysOfCode #myNotes
The learning goals for today: Functions, Indentation and while Loops.
For this we used Reeborg's World's Hurdles 1 - 4 and the end project was to escape the Maze. Go ahead and try it yourself, it's lots of fun!
#begin code - Maze
def turn_right():
turn_left()
turn_left()
turn_left()
#to make sure we start at a wall and not get into infinite loop.
while front_is_clear():
move()
turn_left()
#once at wall, we can follow the right side to the end goal.
while not at_goal():
if right_is_clear():
turn_right()
move()
elif front_is_clear():
move()
else:
turn_left()
#end code