SHOP

PLAY

CREATE

5

Learn how to use conditions

Min. Age: 4+ Mother and son; age icon Duration: 15 min. Mother and son; age icon

Video Example:

Material required: Download material .pdf

program BEGIN block
BEGIN block
program END block
END block
Variable block
Variable block
Assignment block
Assignment block
Random function call
Random function call ('die roll')
Two dice: one dotted and another with numbers
Die of choice
Number tiles for board game
Numbers
Relational operators
Relational operators
Condition block
Condition blocks
Code block
Code blocks
Direction blocks for block-programming
Direction blocks
Function calls for drawing geometric shapes
Function calls for drawing geometric shapes
Whiteboard and marker
Whiteboard and marker
Digital Timer
Timer

Play

1

What is our goal?

You must be very quick!

The shared objective among all players is to successfully draw what you agreed to draw at the beginning of the game using the following program, and do so before time runs out.

2

How do we play?

The game is played in turns. The youngest player starts, then it's the turn of the player to their left, and so on until the game ends.

3

How do we start?

1

Place the blocks as follows:

Block based program conforming a game for conditional function calling
2

Among all players, imagine and agree on a drawing to be drawn on the whiteboard, for example: "a truck".

Imagining the object to draw using the conditional function calling program
3

Set the timer to 5 minutes. In subsequent games, you can reduce the time as a challenge.

You can play the first game without a timer until everyone gets used to the game dynamics, especially if the players are children aged 4-7.

Digital Timer

Are you ready?!

4

What do I do during my turn?

1

All players take their turn in the same way: When it's your turn, hold the empty variable 'a' in your hand.

Variable block 'a'
2

Start by moving to the 'BEGIN' block Block programming 'BEGIN' block . Then slide the variable 'a' into the assignment block.

Block-based program: 'random' function call returning a random number
3

Once in the assignment block, call the random function: Random function call "Calling the random function", roll a die, and assign the result to variable 'a'. "Assigning value 3 to variable 'a' "

4

After assigning the value, move the variable 'a' to the first condition block, saying: "variable 'a' entering condition".

Comparing variable 'a' through conditions
5

Slide variable 'a' downward along the gray "path," evaluating each condition until the evaluation is true:

Evaluating condition a equals 1: false

Is variable 'a' equal to 1? False, next.

Condition evaluation a equals 2: false

Is variable 'a' equal to 2? False, next.

Evaluating condition a equals 3: true

Is variable 'a' equal to 3? True.

6

If the condition is true, follow the 'true' arrow, Path to follow when condition is true in condition block executing the code block.

Code block with a 'draw triangle' function call
7

In the code block, say: "Calling the draw triangle function" and draw a triangle on the whiteboard as part of the "truck". You are required to draw the figure corresponding to the function call.

8

Afterwards, continue following the arrows and finish the program at the END block. "End of the program". Your turn ends here.

Program end
9

At the end of your turn, quickly pass the whiteboard and marker to the next player.

10

On their turn, each player executes the program as the previous player did: They start at the BEGIN block, then move to the assignment block where they roll the die and assign a new value to variable 'a'. Once the value is reassigned to the variable, they enter the condition block and evaluate the conditions. When the evaluation of a condition returns 'true', they call the corresponding drawing function.

5

When does the game end?

The game ends when the timer reaches zero. Does the drawing resemble what you had imagined?

Drawing done by kids of a potato truck

"Potato Truck" (4-year-old children, timer: 5 minutes)

C-max AI tutor wandering

Where can I find more ideas?

Use other functions, such as the undo function undo function call , which deletes the last drawn figure. Or the flipBoard function flip board function call , which flips the whiteboard to continue drawing on the other side.

C-max AI Code Tutor smiling

What have I learned?

You have learned to use conditions, in this case, to condition function calls.

What is a condition? A condition is a block that evaluates an expression as true or false, executing one block or another depending on the result of this evaluation.