The nine dots puzzle first appeared in a magazine in 1907. The dots were eggs, and the task was to connect the eggs in the smallest number of strokes. Today the puzzle is often presented as an exercise in "thinking outside of the box" where the solution lies. Can you connect the nine dots in four straight lines without lifting a pen?
Select the button below to open the Python program in a new window. Run the program and read the lines of code to see if you can understand how it works. It will be helpful to arrange your display so that you can have this browser window on one side of the screen and the code on the other.
Watch this video to learn about the new concepts shown in the program:
The new commands used in this program and others that may be useful. Select them below to learn more:
Moves the turtle to coordinates 0, 0 known as the origin.
Positions the turtle at coordinates x, y. Positive numbers will be to the right / above the origin. Negative numbers will be to the left / below the origin.
Puts the pen down. As the turtle moves it will draw a line between its old position and its new position.
Lifts the pen up. As the turtle moves it will not draw a line.
Draws a circle from the middle of the turtle with a radius x.
Questions to think about with this program to check your understanding:
Explain what the purpose of the numbers 0 and 2 are in line 32.
The numbers in line 32 are coordinates in the nine dot grid. The first number is the column and the second number is the row starting at zero.
(0,0) is the bottom left dot.
(2, 0) is the bottom right dot.
(1, 1) is the middle dot.
(0, 2) is the top left dot.
(2, 2) is the top right dot.
Explain why a subprogram was used in line 23-24 for a single command and called in line 32 with move(0, 2) instead of writing:
turtle.setposition(0, 100)
Change the program below so that it:
Run your code to check that your program has met the success criteria and produces the required output.