100-days-of-code/Day 6/reeborg-maze.py
Mueez Khan 88ad0f92ce
Understanding functions and test cases!
Can copy/paste code into this URL to try it out:
https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Maze&url=worlds%2Ftutorial_en%2Fmaze1.json
Focuses:
- Defining and using functions
- While loops
- PEP8 Indentation styles (4 spaces)
- Spaces vs. Tabs
2021-01-08 13:58:59 -05:00

17 lines
269 B
Python

def turn_right():
turn_left()
turn_left()
turn_left()
while front_is_clear():
move()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
move()
elif front_is_clear():
move()
else:
turn_left()