Year 7 Β· Computing Β· Turtle Academy
🐒🏠

Build a House with Turtle!

Today you'll use everything you've learnt about Turtle commands to code a complete house scene step by step.

🎯 Today you will learn to…

πŸ“‹

Command Reference

Keep this open as you work today

ActionCommandExample
Move forwardFD xFD 100
Move backwardBK xBK 50
Turn rightRT xRT 90
Turn leftLT xLT 45
Lift pen (stop drawing)PUPU
Lower pen (start drawing)PDPD
Repeat commands x timesREPEAT x [...]REPEAT 4 [FD 100 RT 90]
Set pen colour (number)SETPENCOLOR xSETPENCOLOR 4 (red)
Set fill colour and drawFILLED "colour [...]FILLED "blue [REPEAT 4 [FD 100 RT 90]]
Create a procedureTO name ... ENDTO walls ... END
πŸ”’ Exterior Angle Rule β€” use this to work out turn values for any shape:
Turn = 360 Γ· number of sides
ShapeSidesTurn
Triangle3120Β°
Square490Β°
Pentagon572Β°
Hexagon660Β°
Octagon845Β°
1

The Walls 🧱

Draw the main body of the house β€” a square

A house starts with its walls β€” a simple square.
The turtle will go forward 4 times, turning right each time to make the corners.
start

Your target: a square with side length 100 steps

🧠 Plan it first: Without looking at the hint, write out the commands in plain English below.

My Plan (English):

πŸ’» Now write the Turtle code: Fill in the blanks.

; Draw the walls of the house
repeat       [ fd       rt       ]
A square has 4 sides. Each side is 100 steps. At each corner you turn 90Β° to the right.
Think: repeat 4 [...] β€” what goes inside?
πŸ”“ Show Worked Answer (try first!)
; Walls
repeat 4 [ fd 100 rt 90 ]

The exterior angle of a square = 360 Γ· 4 = 90Β°. The turtle repeats: go forward 100, turn right 90Β° β€” four times.

2

The Roof πŸ”Ί

Add a triangle on top β€” and learn to reposition the turtle

The roof is a triangle. But you need to move the turtle to the right position first without drawing β€” use PU (pen up) to move, then PD (pen down) to start drawing again.

Target: triangle sitting directly on top of the square

πŸ”’ Roof triangle turn angle:
Triangle β†’ 360 Γ· 3 = 120Β° turn at each corner.

πŸ€” Think about it: After your walls code runs, where is the turtle and which way is it facing?

My Thinking:

πŸ’» Complete the code β€” the walls are done, now add the roof:

; Walls (already done)
repeat 4 [ fd 100 rt 90 ]

; Move to top-left corner without drawing
pu
fd       ; move up one wall length
pd

; Draw the roof triangle
repeat       [ fd       rt       ]
Move up by the same distance as the wall height (fd 100). Then for the triangle: repeat 3 [fd 100 rt 120]. You might need to adjust your starting direction β€” experiment!
πŸ”“ Show Worked Answer
repeat 4 [ fd 100 rt 90 ]
pu fd 100 pd
repeat 3 [ fd 100 rt 120 ]

PU lets you reposition the turtle without leaving a line. PD starts drawing again. The triangle exterior angle = 360 Γ· 3 = 120Β°.

✍️ Reflection

3

Door & Windows πŸšͺπŸͺŸ

Use PU/PD to add details β€” practice repositioning the turtle

Now add a door (a tall rectangle) and two windows (small squares). Each time, you'll need to PU to move to the right spot, then PD to draw.

Target: door in the centre, windows on each side

Door sizes: width = 25 steps, height = 40 steps (a rectangle)
Window sizes: width = height = 25 steps (a square)

πŸ’» Write the full code for door and windows. Add it to your house code:

; === DOOR ===
pu ; lift pen, move to door position
; (adjust FD/RT values to position correctly)
fd       rt       fd      
pd ; start drawing
; draw door rectangle:
fd       rt 90 fd       rt 90 fd       rt 90 fd      

; === WINDOW 1 ===
pu ; move to window position
                       
pd
repeat       [ fd       rt       ]
For the door (rectangle): fd 40 rt 90 fd 25 rt 90 fd 40 rt 90 fd 25
For a window (square): repeat 4 [fd 25 rt 90]
Use PU + FD + RT to reposition between each shape. Experiment with the numbers to get the positioning right!
4

Colour Fills 🎨

Use FILLED and SETPENCOLOR to bring your house to life

Wrap your shape code inside FILLED "colour [...] to fill it with colour. You can also use SETPENCOLOR x to change the outline colour.
Colour nameNumber code
"red4
"blue1
"green2
"yellow6
"orange14
"brown8
"white7
"gray15

Example β€” a red filled square:

filled "red [ repeat 4 [ fd 100 rt 90 ] ]
Wrap the entire shape code in square brackets after the colour word:
filled "brown [ fd 40 rt 90 fd 25 rt 90 fd 40 rt 90 fd 25 ]
Put your PU/PD positioning before the filled command, not inside it.
5

Command Match 🎯

Match each command to what it does β€” click one from each column

You've learnt a lot of Turtle commands! Can you remember what they all do? Click a command on the left, then click its match on the right. Get all 6 right to unlock the next task! πŸ”“
Progress:
0/6
COMMANDS
print pos
print heading
label "turtle
setlabelfont
repeat 8 [fd 70 lt 45]
repeat 4 [fd 100 lt 90]
WHAT IT DOES
Changes the size or style of a text label
Draws a ⬜ square
Shows the turtle's current coordinates on screen
Draws a πŸ”· octagon
Shows which direction the turtle is facing
Adds a text label next to the turtle
6

Refactor Challenge βœ‚οΈ

Spot the pattern β€” squash the bloat down to one repeat

Each block of code below is doing the same thing over and over. Can you spot the repeating pattern and shrink it down to a single repeat command?
Fill in the blanks to refactor each one πŸ‘‡
Challenge 1 β€” a familiar shape 🟩
fd 100 rt 90  fd 100 rt 90  fd 100 rt 90  fd 100 rt 90
↓  refactor it  β†“
repeat [ fd rt ]
Challenge 2 β€” pointy! πŸ”Ί
fd 80 rt 120  fd 80 rt 120  fd 80 rt 120
↓  refactor it  β†“
repeat [ fd rt ]
Challenge 3 β€” count carefully! πŸ”·
fd 70 lt 45  fd 70 lt 45  fd 70 lt 45  fd 70 lt 45  fd 70 lt 45  fd 70 lt 45  fd 70 lt 45  fd 70 lt 45
↓  refactor it  β†“
repeat [ fd lt ]
⭐

Extension: Garden Scene πŸŒ³β˜€οΈ

If you finish everything β€” design your own scene

Challenge: Turn your house into a full scene by adding the elements below in Turtle Academy. Use what you know about repeat to keep your code clean!
🌳 Tree
Rectangle trunk + repeat 360 [fd 1 rt 1]
β˜€οΈ Sun
repeat 36 [fd 5 rt 10] for a circle
🌸 Flowers
Try repeating a petal shape
🏑 Garden path
Rectangles leading to the door
☁️ Clouds
Overlapping circles with PU/PD
πŸš— Car
Two rectangles + two circles