Earlier you used the four steps of computational thinking to break a build down and make it. One of those steps was algorithms: writing the steps of a solution in order.
Today you learn two ways coders write an algorithm down before they touch a block: pseudo-code (plain steps in order) and a flow chart (the same plan drawn as boxes and arrows). You will plan a small quiz, then build it in Scratch and check the program matches the plan.
An algorithm is a clear set of steps that solve a problem. Coders write it down before they build, so anyone reading the plan knows exactly what should happen.
Today you will write the same plan two ways: as a words plan and as a shapes plan.
Here is the plain-English idea you will plan and build today:
A sprite asks for a name and greets them. It then asks how many counties are in Ireland. If the answer is 32, the score goes up by 1 and it says "Correct!". If not, it says "Not quite".
Here is that idea as sample pseudo-code you can imitate:
The shapes plan draws these same steps in the same order. The one line that becomes a diamond is line 6, the yes-or-no check: yes goes one way, no goes the other. Your teacher will draw this shapes plan on the board as you talk through it.
And here is the same plan as Scratch blocks. Read it against the pseudo-code above, line for line — every line has a block:
when green flag clicked
set [score v] to (0)
ask [What is your name?] and wait
say (join [Hello ] (answer))
ask [How many counties are in Ireland?] and wait
if <(answer) = [32]> then
change [score v] by (1)
say [Correct!]
else
say [Not quite]
end
Turn the quiz idea into a plan on paper or in a notes file. Use the sample as a model.
You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.