GCSE · Computer Science · OCR · Spec J277

Algorithmic thinking

A robot sits in a tiny maze. It knows three commands: FORWARD, TURN LEFT and TURN RIGHT. No guessing allowed. To get it out, you'll spell out every step.

Step it through

Get the robot to the exit

The maze is a 3 × 3 grid. Columns A, B, C run left to right; rows 1, 2, 3 run bottom to top. The robot starts on A1 (bottom left), facing north (up). The exit is C3 (top right). The middle square, B2, is a wall.

Before you press Next: after the first two FORWARDs, which square will the robot be on?

1 // start: square A1, facing north
2 FORWARD
3 FORWARD
4 TURN RIGHT
5 FORWARD
6 FORWARD
7 // exit reached: square C3

Variables

facing=northsquare=A1

Output

 

Step 1: Nothing has run yet. The robot is bottom left, the exit is top right, and the wall at B2 blocks the middle. All it has is your list.

1 / 7

Press Next to run one instruction at a time. Watch the highlighted line, then check the robot's square and direction.

Step 1 of 7: Nothing has run yet. The robot is bottom left, the exit is top right, and the wall at B2 blocks the middle. All it has is your list..

Watch out: Order matters. Run the same five instructions with TURN RIGHT first and the robot heads east along the bottom row to C1, where the next FORWARD walks straight into the edge of the maze.

Your turn to order

A cheese sandwich, one step at a time

Put the steps into an order that actually works

1 · First step5 · Last step
  1. Cut the sandwich in half

  2. Lay the cheese on the buttered slice

  3. Take two slices of bread

  4. Put the second slice on top

  5. Spread butter on one slice

Two command lists, one maze

Route A: up, then acrossvsRoute B: across, then up

Same robot, same start (A1, facing north), same exit (C3), same wall (B2). Read down both columns.

Focus

The instructions

Route A: up, then across

FORWARD, FORWARD, TURN RIGHT, FORWARD, FORWARD

Route B: across, then up

TURN RIGHT, FORWARD, FORWARD, TURN LEFT, FORWARD, FORWARD

The insight

Different lists, even different lengths: five instructions against six. Route B needs an extra turn.

Way round the wall

Route A: up, then across

Up the left side to A3, then along the top row through B3

Route B: across, then up

Along the bottom row through B1 to C1, then up the right side through C2

The turns

Route A: up, then across

One TURN RIGHT at A3: north to east

Route B: across, then up

TURN RIGHT at A1 (north to east), then TURN LEFT at C1 (east back to north)

Where it finishes

Route A: up, then across

C3, the exit

Route B: across, then up

C3, the exit

What do you reckon?

So what counts as an algorithm?

Priya got the robot out with Route A. Sam got it out with Route B. Neither of them went near a computer: they both wrote their lists on paper.

Which is closest to what you think right now?
How sure are you?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Get a robot out of a maze using three commands. Then find a second way out.

What you need to know

  • Computational thinking is a structured, logical approach to solving problems.
  • Algorithmic thinking is one computational thinking technique: you see the solution as a series of logical, step-by-step instructions.
  • Those instructions, designed to solve the problem, are called an algorithm.
  • Each instruction does one exact job: FORWARD moves the robot one square, and TURN RIGHT only turns it.
  • Have a goA robot is facing north. It runs TURN RIGHT, then TURN RIGHT again. Which way is it facing now?

    South.

    Each TURN RIGHT turns it without moving it: north to east, then east to south. East is the tempting answer, but that's after only one of the two turns.

  • Order matters. The same instructions in a different order can send the robot somewhere else entirely.
  • Logical steps fit together, so each one makes sense after the steps before it.
  • Have a goYour friend's toothbrushing algorithm: "Rinse. Brush. Put toothpaste on the brush." Every step is there. So why is your friend about to have a very minty sink?

    The order is wrong: toothpaste has to go on before you brush.

    Each step is fine on its own, but brushing only makes sense after the toothpaste step, so the steps aren't in a logical order.

  • There's often more than one way to solve a problem.
  • So the same problem can be solved by different algorithms, like Route A and Route B.
  • Have a goElla and Jake each write directions from the bus stop to the cinema. Their directions are different, and both get you there. How many algorithms is that?

    Two: different steps, same problem solved.

    It's tempting to think one of them must be the real one, but there's often more than one way to solve a problem, so each working set of steps is an algorithm.

  • An algorithm is the instructions themselves, so a list written on paper still counts.

The big picture

Computational thinking is a structured, logical approach to solving problems. Algorithmic thinking is one of its techniques: you see the solution to a problem as a series of logical, step-by-step instructions. Those instructions, designed to solve the problem, are an algorithm. There is often more than one way to solve a problem, so the same problem can be solved by different algorithms.

Key points

1Computational thinking: a structured or logical approach to solving problems.
2Algorithmic thinking: a computational thinking technique where the solution to a problem is considered as a series of logical, step-by-step instructions.
3Algorithm: the step-by-step instructions designed to solve a problem.
4There is often more than one way to solve a problem, so the same problem can be solved by different algorithms.

Worked example

Problem

The wall moves! Same 3 × 3 maze: the robot starts on A1 facing north and the exit is C3. But now B3 is the wall and B2 is clear. Write an algorithm that gets the robot out using only FORWARD, TURN LEFT and TURN RIGHT.

⚠ Watch out

Thinking a problem has just one correct algorithm, so a different set of steps must be wrong. If two different step-by-step lists both solve the problem, both are algorithms: there's often more than one way to solve a problem.

🧠

Memory hook

Two routes, one exit: an algorithm is A way out, not THE way out.

✓

Check yourself

Cover the page. In one sentence each: what is computational thinking, what is algorithmic thinking, and what is an algorithm? Then explain why Route A and Route B can both be right.

Flashcards

(7)
What is computational thinking?
A structured or logical approach to solving problems.
What is algorithmic thinking?
A computational thinking technique where you consider the solution to a problem as a series of logical, step-by-step instructions.
What do we call the step-by-step instructions designed to solve a problem?
An algorithm.
Can the same problem be solved by more than one algorithm?
Often, yes. There's often more than one way to solve a problem, so different algorithms can solve the same one.
Algorithmic thinking or computational thinking: which one sits inside the other?
Algorithmic thinking is a technique within computational thinking.
Why can't you shuffle the steps of an algorithm however you like?
The steps are logical: each one has to make sense after the ones before it, so a different order can give a different result.
Does an algorithm need a computer?
No. It's the step-by-step instructions themselves, so steps written on paper still count.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More OCR GCSE Computer Science topics

See the full OCR Computer Science curriculum →

How this lesson was checked. This OCR GCSE Computer Science (specification J277)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 3 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.