What you learn

The campaign has eight clearings. Here are the Python ideas in the order they introduce them, each with real lines from a task. The words in blue are the creatures' own commands; everything else is ordinary Python.

Clearing 1

The First Clearing

The clay golem, the stone beetle and the copper bird wake here, one after another. Every job is done by writing the lines out, a few at a time, so the first ideas have room to settle.

New ideas

  • print and text in quotes
  • Commands with arguments, and tiles as (x, y)
  • Lines that run in order
  • Names for values
  • Asking the tile
  • if, True and False
The First Clearing in daylight: the Keeper's cottage, a flower bed, a fountain and a small pond.

The stone beetle takes a step, and pulls only where a weed grows:

forward()if sense("weed"):    pull_weed()

Clearing 2

The Tangled Hollow

The three creatures work in turn: the golem soaks the baked ground under the thorns, the beetle follows the wet trail pulling them, and the bird gathers the fruit they freed. The jobs here are long enough to want a loop.

New ideas

  • Kinds of data: numbers, text, pairs and lists
  • for loops
  • Walking to a whole spot
  • Counting from 0
  • while loops
  • Turning
  • The pot and refill()

The golem's pot runs dry halfway along the bed, so the program stops at the fountain between two loops:

move_to(7, 2)refill()for spot in bottom:

Clearing 3

The Stone Terraces

The terraces repeat themselves, row after row, so this is where a program first gets named parts of its own.

New ideas

  • def
  • not, and walking to the wall
  • A new value for a name

The beetle's sweep, written once and given a name, so it can be called for every row:

def sweep():    while not at_wall():        forward()        if sense("weed"):            pull_weed()

Clearing 4

The Forked Path

Every fruit has to go to its own basket, so the programs here start making choices.

New ideas

  • sense() and dictionaries
  • What a scan hands back
  • Comparing numbers
  • holding and ==
  • and, or
  • else
  • elif

Inside the bird's loop, each fruit goes where it belongs:

if holding == "pear":    fly_to(1, 1)elif holding == "melon":    fly_to(8, 1)else:    fly_to(4, 8)

Clearing 5

The Counting Brook

The bird lays stepping stones across the ford, and the brook wants to know how many it took.

New ideas

  • A name that changes
  • Sums

One more stone each time round the loop, and the total said at the end:

    count = count + 1log(count)

Clearing 6

The Hundred Steps

A hill of ten terraced rows, three flowers on each, and a summit at the top.

New ideas

  • range()
  • range() with a start and a step
  • A loop inside a loop

The bird carries a seed up the steps, counting down from row 10 to row 0:

pick_up()for row in range(10, -1, -1):    fly_to(4, row)drop()

Clearing 7

The Gathering Ledger

An orchard of mixed fruit, and a function that plans the bird's route for any one kind.

New ideas

  • A parameter
  • [] and append
  • return
  • len()
  • in

Ask for a kind of fruit and get back a list of where each one lies:

def plan(kind):    ledger = []    for f in scan(9):        if f["kind"] == kind:            ledger.append(f)    return ledger

Clearing 8

The Night Garden

Rows that run as long as they run, and a journal to write in at the end of the night.

New ideas

  • == and != on text
  • while True and break
  • f-strings
  • An empty list, and found[0]

The golem walks the moonflower row until it reaches the path, however long the row is:

while True:    move_to(col, 9)    if sense()["type"] == "path":        break

and then writes the night's first journal line:

log(f"{count} moonflowers are open")

After the clearings

Wild Gardens

Generated gardens for practice. They open after the Stone Terraces and only ask for ideas you have already met. A seed code grows the same garden for everyone, so a class can work on one together.

The Keeper's Garden

Your own garden once the clearings are done, laid out by a Python program of your own that the game keeps.

Not in the game yet

Some things a beginner course covers are not taught here yet: input(), working with text, slicing, writing your own dictionaries, try and except, and classes.

PlayFor schools