← Teacher guide

Algorithms for classifying shapes

Students follow, fix and test algorithms that classify triangles and quadrilaterals, and describe how each works (AC9M7SP04, nodes 1 and 2).

Year 7 Space · Algorithms · about 40 minutes · Open the student lesson

Classroom resources

Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Timing

Predict and Run 8 min · Investigate 10 min · Modify 10 min · Practise and Make 12 min

Before class

Pilot (Oct 2026): the lesson opens with a real key (five common Australian birds, drawn as a Mermaid flowchart in a short first step) and Make comes back to test it with a bird it was not built for; "Also used in" closes it. The middle of the lesson is unchanged. This pilot tests a Mermaid opening, which decks and worksheets carry; the cost is one extra step pill. Tell us whether it helps.

Do the Run board yourself first. Students need the triangle and quadrilateral classes (Classifying shapes lessons).

The one idea: each shape must reach its own name, so the most specific question comes first. A short algorithm can be wrong; testing on one shape of every class finds it (Pia's mistake).

The board follows the key one question at a time; it is the same tool students use for living things in science. Students design on paper: the Make stretch asks for an algorithm for triangles by angles, drawn as a flowchart or written as numbered steps.

Judging two algorithms for efficiency (fewest questions) and for edge cases (the kite) are wider ideas.

This links to Code: an algorithm written in steps is a program with if and else.

Running the lesson

  1. Predict: ask what the machine should say for the equilateral triangle.
  2. Run: ask which triangle the algorithm gets wrong, and why.
  3. Investigate: ask what test shapes Pia should have used.
  4. Modify: ask students to describe the quad algorithm in words.
  5. Make: back to the bird key. Ask who can find a bird it gets wrong before anyone looks at the options; then ask what every key needs (a way to say 'not in this key'). Then books out: students draw their fixed key as a flowchart and follow a female superb fairy-wren through it, one box at a time, before they pick why she ends at 'not in this key'. Ask what the key should do with her.

Diagrams

A key for five birds. Is it mostly black and white? Yes: Australian magpie. No: is it white with a yellow crest? Yes: sulphur-crested cockatoo. No: is it pink and grey? Yes: galah. No: is it mostly red? Yes: crimson rosella. No: superb fairy-wren.
A bird key · stimulus. A key for five common Australian birds
A key for five birds. Is it mostly black and white? Yes: Australian magpie. No: is it white with a yellow crest? Yes: sulphur-crested cockatoo. No: is it pink and grey? Yes: galah. No: is it mostly red? Yes: crimson rosella. No: superb fairy-wren.
Make: back to the bird key · stimulus. The bird key from the start

The hard part (on purpose)

Ordering the questions. Ask students to say which shape each question separates before they put it in a position.

When students get stuck

What you will seeA question to askThe fix
A student asks the general question first.What would a square be called by this question?Ask the most specific question first.
A student tests on one shape.Which classes has your test not reached?Test one shape of every class.
A student has a path with no end.Where does a 'no' lead?Every yes and every no must lead on to another question or a name.

Answers to the checks

  1. an algorithm with one question: An algorithm asks only: 'Are two sides equal? Yes: isosceles. No: scalene.' A triangle has sides 4, 4 and 4. What does it say?
    Isosceles. Two sides are equal, so it says yes. It never tells the equilateral triangle apart from the others.
  2. follow the algorithm: Follow this two-question algorithm for each triangle in turn. How does it name the 4, 4, 4 triangle? Compare with your prediction.

    Asking 'all three equal?' first gives the equilateral triangle its own name. The one-question algorithm called it isosceles.
  3. Fix the algorithm: How can you fix the one-question triangle algorithm?
    Ask 'All three sides equal?' first
    Ask 'Are all three sides equal?' first, then 'Are two sides equal?'. Test the most specific class first. An equilateral triangle then gets its own name before the wider question is asked.
  4. Find the mistake: Pia tests her algorithm on a rectangle. Click the line where she wrongly decides it works.
    line 5
    Line 5: the algorithm gives a rectangle the name of the wider family. It should ask 'four right angles?' (or 'is it a rectangle?') before it settles for parallelogram.
  5. Testing: How should you test a classification algorithm?
    Run it on a shape of every class
    Run it on at least one shape of every class and check each name: one example of every class shows missing branches and wrong orders.
  6. Order the steps: Put the steps of a triangle algorithm in order.
    see the program below
    Measure first. Test equilateral before isosceles. Scalene is what is left, so it needs no question.
    Start with a triangle and measure its three sides.
    Ask: are all three sides equal? If yes, say equilateral and stop.
    Ask: are two sides equal? If yes, say isosceles and stop.
    Otherwise, say scalene.
    
  7. The triangles: Run the fixed algorithm on all three triangles. Does every one get the right name?

    With the specific question first, each triangle reaches its own name.
  8. The quadrilaterals: Run the quadrilateral algorithm on all five shapes.

    Every shape reaches its own name, and the algorithm asks at most three questions.
  9. A shape it was not made for: A kite (two pairs of equal neighbouring sides, no parallel sides) is put through the quadrilateral algorithm. What happens?
    It is wrongly called a trapezium
    The algorithm has no kite branch. It answers 'no' to the first questions and ends at trapezium, which is wrong. An algorithm only works for the cases it was designed for: add a branch for kites.
  10. Questions for scalene: In the fixed triangle algorithm, how many questions does a scalene triangle need before it is named?
    2
    Two questions: all three sides equal? No. Two sides equal? No. Scalene.
  11. Trace a rhombus: A rhombus (four equal sides, angles 60° and 120°) goes through the quadrilateral algorithm. Which answers does it give, in order?
    Yes, then No
    Four equal sides: yes. All right angles: no. So it is a rhombus.
  12. The longest path: The quadrilateral algorithm asks at most how many questions before naming any of its five shapes?
    3
    The longest path is A, then C, then D.
  13. Review: triangles: Review: a triangle has angles 90°, 45° and 45°. How many of its sides are equal?
    2
    Two equal angles mean two equal sides: an isosceles right-angled triangle.
  14. Which bird?: Test the key with six birds: a magpie, a galah, a sulphur-crested cockatoo, a crimson rosella, a blue male superb fairy-wren, and a common myna (brown, with a black head and a yellow bill). Which bird gets the wrong name?
    The common myna
    The myna answers no to every question, and the last 'no' names every leftover bird a superb fairy-wren. The key was only tested on the birds it was built for.
  15. Fix the key: How should the key be fixed?
    Add a question and a 'not in this key' answer
    Ask one more question before naming the fairy-wren, and add 'not in this key' as an answer. Every path must end in a right answer, and 'not in this key' is a right answer. For example, ask 'Bright blue on its head?' before naming a fairy-wren.
  16. Draw it and run her: Draw your fixed key on paper as a flowchart: the five questions, then 'Bright blue on its head?' before the fairy-wren, with 'not in this key' on its no. Now take a female superb fairy-wren, mostly brown, and follow her through. Where does she end up, and why?
    Mostly black and white? No. (she is mostly brown); White with a yellow crest? No. (she has no crest); Pink and grey? No. (she is brown); Mostly red? No. (she is brown, not red); Bright blue on its head? No. (a female's head is brown); She ends at 'not in this key'. (she says no to every question, and the blue-head question only fits the males)
    Her path is no, no, no, no, no: 'not in this key'. She is a fairy-wren, so the key misses her. The fix is another question for her, and then testing again with her in the test birds.

Solutions

One possible solution for each task. Other correct programs are fine.

design and test › Order the steps

Open task: any program that does what the step asks.

design and test › The triangles

Open task: any program that does what the step asks.

design and test › The quadrilaterals

Open task: any program that does what the step asks.

design and test › A shape it was not made for

Open task: any program that does what the step asks.

Stretch and support

Stretch: Compare two correct algorithms for the same job: which asks fewer questions on average? Then write the triangle algorithm in Python with `if` and `else`.

Support: Give students the questions on cards and ask them to lay out the order before they use the board.

Coach prompt (optional)

For a student who has done the lesson and is still stuck. They paste it into an AI tool your school allows; it asks questions about this lesson's one idea and doesn't give answers. Students see it on the course recap page only through a link ending in ?coach=1: recap with coach prompts.

You are a patient maths coach for a Year 7 student in Australia. Help me understand the ideas in ONE lesson only, from the lesson "Algorithms for classifying shapes".

The ideas:
- Designing a classification algorithm: I can Students design a step-by-step algorithm (as a flowchart or decision tree) that classifies shapes according to their attributes.
- Describing and evaluating algorithms: I can Students describe in words how an algorithm works and evaluate its correctness by tracing through it with test cases.

What understanding looks like:
- Produces a flowchart or decision tree that correctly classifies the target shapes.
- Includes decision points with clear yes/no branches.
- Tests the algorithm on at least two examples and corrects any errors.
- Correctly traces a classification algorithm with a test input.
- Identifies at least one case where a given algorithm fails (if one exists).
- Explains in plain language how the algorithm works.

Mistakes students often make here:
- A student asks the general question first.
- A student tests on one shape.
- A student has a path with no end.

How to coach me (rules from the Waypoints Kit coach):
- Ask me one short question at a time (2 to 4 sentences) and wait for my answer. Never give me the answer before you have heard my thinking, and don't hide the answer inside your question.
- Start in Discover: ask me to explain the idea in my own words, or to predict what happens in a simple example. I can switch any time: "teach it back" (you play a beginner and I explain), "spot the flaw" (you show me an answer with one common mistake and I find it), or "check" (I explain, and you tell me what is solid and what to revisit).
- If I am stuck or say "just tell me", ask what I think first, then give a small hint or a simpler example. Explain only after I have had a real go.
- Stay in this idea: don't teach later ideas or add extra content. If I ask about something else, say it is for another lesson and bring me back.
- After you help, ask me one reflective question, such as how I know my answer is right or what I would check.
- Praise my effort and method, not my ability.
- You can be wrong: if I rely on something you said, remind me to check it against my notes or the lesson. If you don't know, say so.
- Use simple words.
- Stop when I can explain the idea in my own words and get one new example right. Then tell me to go back to the lesson "Algorithms for classifying shapes".

Exit ticket

Why must a classifier ask 'are all three sides equal?' before 'are two sides equal?'

An equilateral triangle has two equal sides too, so the wider question would give it the wrong name.

What each step is for

Where it leads

This completes AC9M7SP04.

Where it leads: algorithms in code (the Code pathways), flowcharts for other decisions, and decision trees in Probability.

Sources