MAKERS CAN CODE - WEEK I SCRATCH

Scratch.jpg
  • The session will be conducted through the 'Zoom' Application. The participant has to attend the session through one device and use the 2nd device for coding. The Zoom device should be on the landscape mode, for better visibility.

 

  • The link for the session will be sent TO THE GROUP 15 min. prior to the session.

 

 

  • Create an account on the SCRATCH website and make sure that you are logged in before the session .

INTRODUCTION TO ALGORITHMS

Tea Making algorithm

Making a cup of tea:

 

Get cup from shelf

Put tea bag in cup

Fill kettle with water

Turn kettle on

Pour water from kettle into cup

Add milk

Add sugar

The robot hasn’t done a very good job of making a cup of tea! The water is poured instantly from the kettle into the cup after the kettle has been filled, meaning that the water is still cold. The tea bag is never removed, and way too much water is added. We also haven’t told the robot how much milk or sugar to add.

Oh dear, we haven’t been very clear with our instructions!

 

For an algorithm to be useful, the steps need to be precise, and in the correct order. Our algorithm was missing some details and some whole steps, which made things go wrong when the robot tried to use it to make tea. (Problems that arise because of mistakes like this are called bugs.) Our tea making algorithm could be made more precise by adding instructions, as well as adding detail to existing instructions. 

Tea Making algorithm - corrected

Making a cup of tea:

 

Fill kettle with 300ml water

Turn kettle on

Get cup from shelf

Put tea bag in cup

Wait for the kettle to boil

Pour water from kettle into cup

Add 20ml milk if required

Add the required amount of sugar

 

Notice that the task that our algorithm carries out hasn’t changed, but turning on the kettle first and then getting a mug while the kettle is boiling saves us some time. There will be other instructions for which the order is not important: for example, whether to add the milk before or after the sugar.