Fix the code

Supporting children in using the process of debugging to achieve specific goals

Activity idea: Broken pipes

The video on the left shows what is happening when the game ‘The Flying Dragon’ is played whilst the game on the right shows what should happen when the game is played.This activity requires children to fix the code in order to make the pipe sprite work correctly.

The broken code is downloadable here

This activity is designed to support children in being able to debug code, where they need to decompose the problem into smaller parts in order to find the piece of code which is causing this glitch. Encouraging the children to manipulate the code also develops their logical reasoning, where they need to predict what will happen when certain algorithms are changed.

This activity can support children in understanding programming language where they are required to move blocks around, developing their computational thinking. It also supports children in understanding that algorithms have to be precise in order to be executed successfully.


Activity idea: Help! I think the accelerometer is broken!

This activity idea focuses on the micro:bits accelerometer which is used to determine the tilt of the micro:bit. Within the game, the micro:bits tilt is used to move the dragons position: tilting left should move the dragon left, tilting right should move the dragon right, tilting up should move the dragon up and tilting down should move the dragon down. But this isn’t happening. Children should watch the video below to see what happens on certain tilts of the micro:bit, before exploring the code which can be viewed here.

This activity requires children to use simple algorithms to explain what is happening in the video above. They can then use their knowledge of algorithms to detect errors through debugging and correct these errors within the algorithm. Children can also use logical reasoning within this activity to predict what will happen when they change the motion blocks, causing the dragon to travel in a particular direction.

This activity can develop children’s understanding of programming languages where they are required to manipulate and choose specific blocks to use. It will also cause children to understand the importance of sequencing within coding, where the placement of certain block determines the outcome of different algorithms.

Can this activity be made cross-curricular?

This activity has ties with Maths, where children are expected to use the language of position, direction and movement. Children can use such language when talking about the tilt of the micro:bit: left, right, up and down and when talking about what is happening to the dragon sprite.


Print Friendly, PDF & Email