Levels 5 to 9 are problems that resemble real-world programming. With the introduction of loops and conditionals, you have started to design algorithms into your code. Your Blockly code takes input – what paths are around the character, and whether they are at the red pin or not. Next, it processes that input through logic, and emits output – what the character should do. Your code runs until it completes.
Your code would also work for similar mazes. For example, the solution to Level 8 is a path-following algorithm. The correct answer would work for any length of maze as long as there were no forks off it.
Note how you were having to pay attention to the problem itself in order to come up with a solution. In Levels 7 and 9, there are a lot of paths in the maze that aren’t actually relevant to the solution. By identifying the actual problem that needs solving – the path to the finish line – it becomes easier to write the appropriate code to solve that problem.
Don’t worry if you struggled on some of the levels. Blockly is designed to get more challenging as you progress up the levels. How did you get on with the more complex control-flow structures – the green loops and blue ‘if’ blocks? Did anything surprise you as you were working on the exercises?
Can you also think of ways these types of control flows are used in the wider world?
What problems are particularly well-suited to this kind of logic?
How do you imagine this kind of code growing with complexity, and how do you think programmers manage that?