KS3 Computing · An algorithm is a precise, step-by-step plan to solve a problem. Computational thinking turns a messy problem into one. Every algorithm is built from just three things: sequence, selection and iteration.
ProgrammingNetworks and Digital CommunicationCambridge Lower Secondary Computing 0860
You will learn to
Create a success list with your guild before anyone starts building.
Use decomposition to split the game into parts, and the work between two pairs.
Create a Scratch mini-game in small steps, testing after each one.
Success criteria
I can say what 'finished' means, using our success list.
I can show my part of the project working after each small step.
I can write a short log of what I did today and what comes next.
Key words
Say each word, then read what it means. Every one is in the glossary too.
Algorithm
Precise, ordered, finite steps to solve a problem.
Decomposition
Breaking a problem into smaller ones.
Abstraction
Ignoring detail that doesn't matter for the problem.
Sequence · selection · iteration
Steps one after another. First this, then this.
Pseudocode
Code-like writing for algorithms, without strict rules.
Trace table
Records variable values step by step to check logic.
Variable
A named place in memory that holds a value.
The explanation
Read it here, or open the study page below to go one step at a time with things to try.
Start with a success list
A success list says what 'finished' looks like. The guild agrees it before anyone builds.
Each line must be something you can check: yes, it does that, or no, it does not.
e.g.Example
Cause: keep our beaches clean. Here is that guild's success list.
The poster has one clear message.
Every image has a credit line.
The player moves with the arrow keys.
The game has a score and an ending.
The game tells the player one fact about the cause.
Another guild has tested the poster and the game.
Split the game into parts
Two people make the poster. Two people make the game. Both pairs follow the same success list.
The game pair uses decomposition: they break the game into parts, one job each.
Part
What it does
Bin (the player)
Moves left and right with the arrow keys
Litter
Falls from a random place at the top of the stage
Score
Goes up by 1 when the bin catches the litter
Lives
Go down by 1 when the litter reaches the sand
Ending
At 0 lives, says 'Game over' and one fact about the cause
Build in small steps
Build the bin first and test it. Then the falling litter. Then the score, then the lives. Test after every part.
Here is the litter script once the score and lives parts are added:
when green flag clicked
go to x: (pick random (-200) to (200)) y: (170)
forever
change y by (-5)
if <touching (Bin v)?> then
change [score v] by (1)
go to x: (pick random (-200) to (200)) y: (170)
end
if <(y position) < (-170)> then
change [lives v] by (-1)
go to x: (pick random (-200) to (200)) y: (170)
end
end
The litter starts at a random spot along the top.
Each time round the loop, it falls 5 steps.
Caught by the bin? Score goes up and the litter jumps back to the top.
Reached the bottom? Lives go down and the litter jumps back to the top.
★Remember
The Scratch stage runs from x = -240 to 240 and y = -180 to 180. So y = 170 is near the top.
Keep a log
A log is a short diary of the project. Write two or three lines at the end of each lesson.
e.g.Example
Lesson 4: the bin moves and the litter falls. Problem: the litter falls too fast. Next: slow it down, then add lives.
?Why?
Why keep a log?
Next lesson you know where to start. And in the presentation you can say what you fixed.
e.g.Worked example
Your game has five parts: bin, litter, score, lives and ending. In what order do you build them?
Bin first: you need a player to test everything else. Test that the arrow keys move it.
Litter next: test that it falls from a new random place each time.
Score: test that catching the litter adds exactly 1.
Lives: test that a miss takes away exactly 1.
Ending last: it needs the lives to work. Test that the game stops at 0 lives.