SHOP

PLAY

CREATE

1

Learn how to decompose and how to use functions

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

Video Example:

Material required: Download material .pdf

Whiteboard and marker
Whiteboard and marker
Drawing cards with geometric shapes
Drawing cards with geometric shapes
Function call board
Function call board
Function calls for drawing geometric shapes
Function calls for drawing geometric shapes

Play

1

What is the goal?

Players must replicate a drawing on the whiteboard by calling functions.

2

How do we start?

1

Place each of the function calls for drawing geometric shapes on the function call board as follows:

Functions placed on the call board
2

Explain to all players what function calls are:
"Let's call the functions for drawing shapes: If we call the 'draw circle' function, we will draw a circle on the whiteboard. If we call the 'draw line' function, we will draw a line on the whiteboard. If we call the 'draw triangle' function, we will draw a triangle, etc."

Calling functions draw circle and draw line

Make sure the players understand by asking, "What happens if we call this function?" and "What happens if we call this other one?"

3

Then, the youngest player choose a drawing tile from among the tiles available on the first pages of this manual (house, girl, bird, locomotive).
Example: The player chooses the 'house' drawing.

Drawing card with a house formed by basic geometrical figures
4

The player must answer the question: "What shapes can we decompose the drawing into?"

Example: "The roof is a triangle, the door is a rectangle, the chimney is a rectangle, the smoke consists of 3 circles, the tree consists of 5 lines and curves, etc."

Decomposed house formed by basic geometrical figures
3

Once the drawing is decomposed, how do we play?

Once the drawing is decomposed, one of the players calls the functions to draw a shape, and the other player draws it on the whiteboard with the marker. You continue this process until the drawing is complete.
Example:

1

Player 1: "Calling the 'draw triangle' function."

Calling a function that draws a triangle

Player 2 draws a triangle as a roof.

Drawing a triangle as a roof of a house on a whiteboard.
2

Player 1: "Calling the 'draw rectangle' function."

Calling a function that draws a rectangle

Player 2 draws a rectangle as walls

Drawing a rectangle as the walls of a house on a whiteboard.
3

Player 1: "Calling the 'draw rectangle' function."

Calling a function that draws a rectangle

Player 2 draws a rectangle as a door

Drawing a rectangle as the door of a house on a whiteboard.
4

Player 1: "Calling the 'draw circle' function."

Calling a function that draws a circle

Player 2 draws a circle as a window

Drawing a circle as the window of a house on a whiteboard.
4

When does the game end?

The game ends once you have completed the drawing.
You can play again, but this time reverse the roles, let the other player call the functions.

C-max AI tutor wandering

Where can I find more ideas?

1

Variant: The player chooses a drawing card from those without defined geometric shapes.

Drawing cards: a boat, a car, a robot and an owl

Ask the same question: "What shapes can we decompose the drawing into?" Once the question is answered, call the necessary functions to make the drawing as in the previous example.

2

You can use other available function calls.

Function calls to draw geometric figures
3

There are also "blank" tiles that you can use to invent calls to new functions. Write on these tiles using the marker.

Blank tile for board game
C-max AI Code Tutor smiling

What have I learned?

In a very simplified way, you have learned to decompose and call functions to perform different tasks.

What is decomposition? Decomposition is breaking down a problem into smaller problems to make execution easier. For example, if you want to draw a house, you first associate each part of the house with a basic geometric shape, and then you draw each part of the house using those basic shapes.

What is a function call? A function is a block of code that contains a series of instructions to perform a task, such as "draw a circle". When a function call is made, the program executes that function, which in the example draws a circle.