To explore more complex routes that include traffic lights and limited blocks
To further develop the pupils' understanding and application of complex if..else if..else
Computers with internet access
Projector or Interactive Whiteboard (IWB)
Ask pupils what they know about traffic lights
Show the video on Level 44 or using this link
Ask pupils what their parents or bus driver do when they come to a red traffic light. Answer: They wait until they turn green...
How do they know if they should stop? They should look to see if they are at traffic lights and if the light is red.
Ask pupils to look at the suggested solutions on slide 5. Will they work? If they are not sure, get them to copy them into level 44 and explain why they don't.
You should only wait if the traffic light is red and the if
block must be inside a look so that you can keep checking to see if the light is red.
Pupils should then do levels 44 and 45
They need to include an else-if
block to check for a right turn
Ask pupils to do levels 46 and 47
Show pupils level 48 and ask them what they need to do. They need to deliver to four houses.
Point out the new deliver block
Ask pupils how they can extend their solution from level 47 to solve this route
Pupils should then continue to level 49
Extension: Level 50. This is a tricky one so don't worry if not everyone can solve it.
Show pupils level 51 and point out that the types and number of blocks they can use is limited
Use what remains of the lesson to allow pupils to try some of these levels
Share and Review (5 mins)
Ask pupils which block is used to ask a question. The answer is the if
block
Ask pupils why the if
block must be inside the loop when we are checking for traffic lights or turns. The answer is so that we continually check as we are moving along the route.
Discuss what they found challenging and how they solved their problems.
Demonstrate level 44 without considering the traffic lights. You could use any of the loops but it is best to use repeat-until at destination
block
Can they see blocks that will help them to introduce these ideas into their code?
You might need to remind pupils how to add an else
block to their if block
NB: The if traffic light red block includes a check to see if they are actually at the traffic light. It is intended as a simplification so that pupils don't need to add too many if blocks. Have a look at this solution and ensure that your pupils understand it.
Show level 46 on the IWB and ask pupils what additional check they need to make
The solution is below. Notice that they reach their destination four times and need to deliver after they reach it and then continue to the other houses.