I’ve been working with year 4 making quizzes in Scratch – an idea from Phil Bagge’s excellent Junior Computer Science planning. Once the basic ‘if / else’ loop is in place, there are various ways the children can adapt their program to make it more interesting. Some children added sound for right and wrong answers, some used broadcasts to change the background depending on the answer, some included scoring – all great ideas.
One child wanted to repeat the question so that, if the player got it wrong, it wouldn’t simply move on to the next one but would give them another chance until they got it right. This is particularly good for a times table quiz where it’s possible to come up with the answer through calculation if the player’s initial recall is wrong, although it would be much more frustrating in a general knowledge quiz where there is no way to find the correct answer if the player doesn’t know it! Nevertheless, it gave a good excuse to explore the ‘repeat until’ block, which the children hadn’t previously used.
After that, another child wanted to include a ‘hint’, which could be chosen if the player was stuck by selecting ‘h’. This involved a much bigger problem because an ‘if / else’ loop only really includes two options and there is no way to use a sensing ‘if key pressed’ block once a question has been asked. We experimented with various (often more complicated) options until eventually coming up with the following solution of putting an ‘if / else’ inside another one to provide another layer of possibility. Once all of the options have been exhausted, the next question is presented and the code simply duplicated as many times as is required. To get to this stage, quite a bit of thinking, drawing and ‘trial and error’ tinkering was needed! This is a good illustration, though, of how programming really is a problem solving activity where, often, there is more than one way to reach a given outcome. The trick is to find the most efficient way to achieve it.