# Nine Dot

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?

## Try

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:

#### Knowledge Organiser

Command summary

The new commands used in this program and others that may be useful. Select them below to learn more:

turtle.home()

Moves the turtle to coordinates 0, 0 known as the origin.

turtle.setposition(x, y)

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.

turtle.pendown()

Puts the pen down. As the turtle moves it will draw a line between its old position and its new position.

turtle.penup()

Lifts the pen up. As the turtle moves it will not draw a line.

turtle.dot(x)

Draws a circle from the middle of the turtle with a radius x.

## Investigate

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)

1. Using a subprogram for the conversion of coordinates into a position makes the code from line 32 easier to read.
2. The calculation is only coded once instead of each time it is needed. This makes the program easier to debug, reducing the chance of calculation errors.
3. When solving the puzzle you only need to think about the dot on the grid and not the position of the dot on the canvas.

## Make

### Success Criteria

Change the program below so that it:

1. Solves the nine dot puzzle in four lines of code. Lines 32, 34, 36 and 38. The turtle must start at the bottom left dot.

## Evaluate

Run your code to check that your program has met the success criteria and produces the required output.

Registered in England and Wales: 10442992

VAT Number: 290 9845 58

Telephone: 01452 947500