Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions en/meta.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
title: default-project-template
title: Turtle race
hero_image: images/banner.png
description: default-project-template description
description: Use random to race two turtles. The first one to reach the finish line wins.
version: 1
listed: false
copyedit: false
last_tested: "2025-01-01"
steps:
- title: Step 1
- title: Step 2
- title: Step 3
- title: Step 4
- title: Step 5
- title: Step 6
- title: Step 7
- title: Step 8
40 changes: 30 additions & 10 deletions en/step_1.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<h2 class="c-project-heading--task">Add a turtle</h2>
--- task ---

Create your first racing turtle and get it ready at the starting line.
--- /task ---

<h2 class="c-project-heading--explainer">Say hello to Ada! 🐢</h2>

<div style="position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 20px; box-shadow: 0 0 15px #3fb654; overflow: hidden;">
<iframe
src="https://www.youtube.com/embed/GaoChS1fG3o?rel=0&cc_load_policy=1"
style="position: absolute; inset: 0; width: 100%; height: 100%; border: none;"
allowfullscreen>
</iframe>
</div>
--- task ---

Start by adding one turtle to the screen. You can name the turtle anything you like — here, it is called `ada`. This turtle gets a colour and shape, then moves to its starting position on the track.
Start by adding one turtle to the screen.

You can name the turtle anything you like — here, it is called `ada`.

This turtle gets a colour and shape, then moves to its starting position on the track.

--- /task ---

<div class="c-project-code">
--- code ---
Expand All @@ -32,3 +31,24 @@ ada.goto(-160, 100)
ada.pendown()
--- /code ---
</div>

<div class="c-project-output">
![4 turtles of different colours aranged in a vertical line on the screen](images/step_1.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- You can change the colour of the turtle to anything you like.
- The `goto` sets the `x` and `y` postition of the turtle on the screen.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- Make sure you have quotes around the colour - `'red'`

</div>
52 changes: 52 additions & 0 deletions en/step_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<h2 class="c-project-heading--task">Add another turtle</h2>

Give your race a second speedy turtle.

<h2 class="c-project-heading--explainer">Meet Bob! 🐢</h2>

--- task ---

Create a new turtle called `bob`.

Set Bob’s colour and shape, then move him to the next starting spot.

--- /task ---

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 11
line_highlights: 11, 12, 15
---
bob = Turtle()
bob.color('orange')
bob.shape('turtle')
bob.penup()
bob.goto(-160, 70)
bob.pendown()
--- /code ---
</div>

<div class="c-project-output">
![2 turtles of different colours lined up on the track](images/step_2.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- You can pick any colour name you like for `bob`.
- `penup()` stops the turtle drawing a line while it moves.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- Check `bob` has a colour in quotes, like `'orange'`.

</div>
52 changes: 52 additions & 0 deletions en/step_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<h2 class="c-project-heading--task">Add a third turtle</h2>

Now your race needs one more turtle.

<h2 class="c-project-heading--explainer">Hello, Eve! 🐢</h2>

--- task ---

Create a turtle named `eve`.

Give Eve a colour and shape, then move her to the starting line below Bob.

--- /task ---

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 18
line_highlights: 18, 19, 22
---
eve = Turtle()
eve.color('yellow')
eve.shape('turtle')
eve.penup()
eve.goto(-160, 40)
eve.pendown()
--- /code ---
</div>

<div class="c-project-output">
![3 turtles of different colours lined up on the track](images/step_3.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- `shape('turtle')` makes sure your turtle looks like a turtle.
- Try a different colour for `eve` if you want.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- Make sure you used `eve` in every line for this turtle.

</div>
52 changes: 52 additions & 0 deletions en/step_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<h2 class="c-project-heading--task">Add the fourth turtle</h2>

Every race needs a full line-up.

<h2 class="c-project-heading--explainer">Say hi to Kai! 🐢</h2>

--- task ---

Create a turtle called `kai`.

Set the colour and shape, then move Kai to the last starting spot.

--- /task ---

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 25
line_highlights: 25, 26, 29
---
kai = Turtle()
kai.color('green')
kai.shape('turtle')
kai.penup()
kai.goto(-160, 10)
kai.pendown()
--- /code ---
</div>

<div class="c-project-output">
![4 turtles of different colours lined up on the track](images/step_4.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- Give `kai` a colour that stands out from the others.
- Each turtle sits on a different y-position so they do not overlap.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- Check `goto(-160, 10)` uses a comma between x and y.

</div>
49 changes: 49 additions & 0 deletions en/step_5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<h2 class="c-project-heading--task">Get the track pen ready</h2>

Now set up the turtle that will draw the race track.

<h2 class="c-project-heading--explainer">Ready, set, draw! ✏️</h2>

--- task ---

Lift the pen so no line is drawn.

Move to the top-left corner of the track and make the turtle draw fast.

--- /task ---

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 32
line_highlights:
---
penup()
goto(-140, 140)
speed(10)
--- /code ---
</div>

<div class="c-project-output">
![the track turtle moved to the top left, ready to draw](images/step_5.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- `speed(10)` makes drawing faster so you do not have to wait.
- `goto(-140, 140)` moves to the top-left corner of the track.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- If you see a line, make sure `penup()` comes before `goto()`.

</div>
49 changes: 49 additions & 0 deletions en/step_6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<h2 class="c-project-heading--task">Number the track</h2>

Add number markers along the top of the race track.

<h2 class="c-project-heading--explainer">Count the steps! 🔢</h2>

--- task ---

Use a loop to write the numbers `0` to `11`.

After writing each number, move forward to the next spot.

--- /task ---

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 36
line_highlights:
---
for step in range(12):
write(step, align = 'center')
forward(20)
--- /code ---
</div>

<div class="c-project-output">
![numbers 0 to 11 written along the top of the track](images/step_6.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- `range(12)` gives you the numbers `0` to `11`.
- `write(step)` prints the number on the screen.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- If all the numbers sit on top of each other, check `forward(20)` is inside the loop.

</div>
55 changes: 55 additions & 0 deletions en/step_7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<h2 class="c-project-heading--task">Draw the race lanes</h2>

Add the long lane lines under each number.

<h2 class="c-project-heading--explainer">Make the track! 🏁</h2>

--- task ---

Inside the loop, turn and draw a line down for each lane.

Then move back up, face forward again, and write the next number.

--- /task ---

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 36
line_highlights: 38-44
---
for step in range(12):
right(90)
forward(10)
pendown()
forward(150)
penup()
backward(160)
left(90)
write(step, align = 'center')
--- /code ---
</div>

<div class="c-project-output">
![lane lines drawn down the track under each number](images/step_7.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

- `pendown()` starts drawing the lane line.
- `penup()` lifts the pen so you can move without drawing.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

- If your lines go the wrong way, check the `right(90)` and `left(90)` turns.

</div>
Loading