The aim of this challenge is to use Python Turtle to trace a path to solve this circular maze.
By doing so we will investigate how we can draw different arcs of different radiuses and different lengths to guide the Python turtle through the maze.
Our Python code will make use of a function called drawArc() that takes three parameters:
- The radius of the arc (in pixels)
- The starting angle of the arc (in degrees)
- The angle of the arc (in degrees)
To fully understand the purpose of these three parameters let’s look at the following three examples:
The third examples demonstrate how we can use a negative angle to change the direction of the arc. A positive angle draws an arc anti-clockwise, whereas a negative angle draws and arc clockwise.
Now let’s use Python Turtle to solve this challenge.
Python Code
We have started the code for you and drawn the first two arcs using our drawArc() function. Your task is to complete this code by drawing additional arc until you reach the exit gate.
To complete this challenge, you will have to use a trial and error approach, testing your code with different parameter values when using the drawArc(), forward() and setheading() functions and refining your code by tweaking these values.
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area