Challenge: Driving in patterns
Challenge: Driving in patterns
So far, you have been testing that the robot buggy moves appropriately in response to the commands .forward(), .backward(), .left(), .right(), and .stop().
You have also used the sleep() command to make the program wait for a specified number of seconds before running the next command, thus enabling the buggy to either move or stop moving for a certain amount of time.
Developing a new algorithm
The next task is for you to create and test an algorithm that drives the buggy in a certain pattern.
Start by creating a program that makes your robot drive in the shape of a square.
Then try another pattern, for example:
- A triangle
- A star
- A figure of eight
You could also include a loop in your program so that the buggy repeats a pattern more than once.
Discussion
Once you’ve completed a challenge, share your code below, along with any comments or questions.
To include code in comments, you will have to use three tilde characters (~~~) before and after your code, as in this example comment text:
I created this program.
print("This is my code")

Refer to our 'Sharing code on FutureLearn' guide for more information.