Session 6

Learning targets

I can use an algorithm to create a game

I can explain the purpose of an algorithm

Robot Pop

  • Show the children the game ‘Robot Bop’ and give them a few minutes to play it. The game is a simple one where robots randomly appear and disappear, but if you click on them they will play a sound and disappear more quickly.

  • Remind the children of the termalgorithm and explain that before we start coding, we’re going to ‘decompose’ the project and write an algorithm. The term ‘decomposing’ means to break something down into small parts.

  • Remind the children that an ‘algorithm’ is a set of instructions which explain how the program is going to work – the algorithms makes it a lot easier to create a program ourselves.

  • Show the children how to start a new Tynker project with the monster actor and the white grid background – explain that their algorithm will take the project from nothing into a game. By following their algorithm, they will be able to code their own version of the game.

  • Ask them what happened in the 'Robot Pop' game. Go through the following questions and encourage children to be really specific with their answers:

What happened when you clicked the green flag?
– The robots started disappearing
– The robots started moving

Where did they move to? Could you tell where they’d go next?
– A random place
– The robot reappeared

How many times did they keep appearing and disappearing?
– Forever

What happened next in the game? What did you do to play it?
– Click on the sprites/actors

What happened when they were clicked?
– The robots made a sound
– The robots disappeared

  • As they’re telling you what is happening, make notes on a board for the children to refer back to later. What they’re creating here is the algorithm, the recipe for the program.

  • Now, hand out the Coding blocks sheet (below) for the children to work in partners and get the children to cut out each of the blocks.

  • They will need to match each of the blocks to the algorithm that you have created together on the board. By creating paper versions of their script, the children will be reinforcing the relationship between the code and the algorithm which will get the children to think more carefully about what the blocks are doing so that they select blocks to create their script purposefully rather than at random.

  • Their paper script should look something like the code in the project:

  • When the children have their paper code, they can go on to the Tynker app and recreate it using code blocks within 'New Project'. The actor and backdrops that the children use for this project don’t matter, so you could tie it in with a current topic/affair/book you’re studying.

  • For this project, we can create one actor and then use Tynker s ‘duplicate’ feature to make more actors with identical code. Simply click the 3 dots on the actor and select ‘duplicate’ from the menu

Extension

For those who complete this quickly, there are some challenges for them to try:

  • Can you change the size of each of the actors so some are harder to get?

  • Can you change the ‘wait’ time to make the game easier/harder?

  • Can you make the size of the actors change randomly?

Key questions

  • What happened in the ‘Robot Bop’ game?

  • What happened when you clicked the green flag?

  • Where did the move to? Could you tell where they’d go next?

  • How many times did they keep appearing and disappearing?

  • What happened next in the game? What did you do to play it?

  • What happened when they were clicked?

  • Can you change the size of each of the sprites so some are harder to get?

  • Can you change the ‘wait’ time to make the game easier/harder?

  • Can you make the size of the sprites change randomly?