# 2. An event

An event provokes an action. You push a certain button and your TV turns on, you push your mouse button and your computer starts, ...

An event lets a user influence an algorithm, Without events, computer games could not exist. As a player you want to influence the game progress, don't you?

In this activity, as a teacher, you operate a large paper control board on which the students take action. Or… how your dream as a teacher becomes reality!

Your students will:

• Repeat instructions given by you
• Recognize teacher actions as associated with commands.
• Distinguish between predefined actions and event-driven actions.

## STEP 1

### Preparation

Print the practice sheet for each student.

Print the 2nd page for yourself (the control panel). Can you print it in A3 format or do you project it on the board?

## To work!

Look back with your students on the previous exercises where the computer always knew exactly where the robot should end up. In real computer programs, however, we want to be able to make choices, so that we can influence the program. Usually at the start of a program you do not yet know what you would like later. You must be able to determine that during the program by intervening.

For example, every game you play on the computer will be different from the previous one. After all, it is you who always decides what your figure should do.

Take page 2 of the worsheets: the large control panel. Now agree with your students what each button does. For example, the yellow circle can be “wow”, the red rectangle “wooow” and the blue triangle “wiew”! For example, the white cross is… nothing! Now practice this with your class until they get the hang of it. Vary a bit in speed and rhythm.

Each “button” is now an event that triggers your class to take a particular action.

Have your class now perform a task such as saying the multiplication tables, which you interrupt regularly by pressing a button on your control panel. This way your students can see the difference between algorithms that are run through and “events” that break them

## STEP 3

Discussion

Why do we need to be able to intervene in algorithms?

Where in our area do we see “events”?

# Differentiate!

Leave your control board hanging for the rest of the school day and irregularly break through the other lessons by pressing some button. You will see: your students are more attentive than ever!