C3.1 Solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves sequential and concurrent events.

Skill: Solving Problems Using Computational Methods


Coding can be used to automate tasks and visualize mathematics to facilitate problem solving. By its very nature, coding lends itself well to trial-and-error learning, giving students the opportunity to solve problems by learning from their mistakes. Therefore, the student can use the questioning "What will happen if…?"

The student, for example, might ask, "What happens if two sprites contain the same code?" or "What happens if two sprites contain the same number of moves, but the code is not the same?" Using this example, it is possible to explore the concept of equivalence and facilitate a mathematical conversation about it. First ask students the following question:

  • Are the movements of the two sprites equivalent?
  • Yes, both sprites arrived at the same place.
  • Yes, both sprites have moved for the same amount of time.
  • No, the two sprites have made different moves.
  • No, the two sprites are not stopped at the same place.

Note: It is important to allow students to experiment with the code and not demonstrate at this point. This will affect the answers.

Skill: Representing Mathematical Situations in Computational Ways


Coding can be used as a representational tool in the same way as manipulatives. By using written blocks or commands, very complex mathematical situations can be modeled and manipulated visually, which can make very abstract concepts concrete.

The student, for example, can code a "parade of sprites" to represent two repeating patterned patterns at the same time using code. The code inside the sprite could have a repeating pattern of movement that is accompanied by a repeating pattern of lyrics to a song. Here is an example of possible code:

Sprite chicken: Start on green flag, move right one time two times, hop right one time two times, move right one time two times, hop right one time two times, move right one time. Start on green flag, say ‘I’, say ‘am’, say ‘a’, say ‘chicken’., say ’I’, say ’am’, say ’a’, say ’chicken’.

Here, we see two different patterns with a repeating pattern at the same time, namely a pattern ABBA and a pattern ABCD.

Skill: Writing Code


Writing or editing a code consists of putting instructions in a specific order, following the syntax of a programming language. Writing code can be similar to writing text. Pseudocode is writing the instructions for a code in the familiar language. Block coding can make it easier to follow the syntax by using different block shapes and colours.

The following situation, for example, presents two butterflies that must complete an obstacle course:

Scene of the classroom created with coding imagery. The scene has two butterflies, deux chairs, two tables, carpet, one glass, and terrestrial globe.


Students could write code so that both butterflies start the race at the same time, but one butterfly reaches the target before the other. The resulting code might look like this:

Possible yellow butterfly code:

Sprite butterfly. Start on green flag, move up two times, move right 4 times, 4 down 3 times, move right 6 times, move up two times, move down two times, move right 3 times, move up 3 times, move right one time, move up one time, move right two times, move down two times, move right two times, move up 3 times, move left one time, move down two times, move right one time, say ‘I’, end.

Possible purple butterfly code:

Sprite butterfly. Start on green flag, move up two times, move right 4 times, 4 down 3 times, move right 6 times, move up two times, move down two times, move right 3 times, move up 3 times, move right one time, move up one time, move right two times, move down two times, move right two times, move up 3 times, move left one time, move down two times, move right one time, say ‘I’, end.

Skill: Executing Code


Code execution is the step in which the code pattern is read and compiled by the computer. It is at this stage that a functional code will give the desired result, or output, (and a non-functional code will give a different output or no output at all). In block coding, code execution is often done via a button in the interface, while some robotics devices require specific compilation software that essentially translates the code from the programming language to the robot's language.

Some examples of run buttons for block coding software:

Examples of coding execution button.

Source: Microbit.

Examples of coding execution button.

Source : Scratch.

Knowledge: Simultaneous Events


Simultaneous events are simply events that occur at the same time. Note, however, that events do not have to be identical to be considered simultaneous.

A common example of using simultaneous events is diagonal moves. Most block coding and robotics software will allow moves in four directions (for example, up, down, left, right), but a diagonal move requires a horizontal and a vertical move at the same time.

Let's take, for example, the following imaginary city:

Cartographic image of a village.

In order for a sprite to get from the police station to the school, it will need to make a horizontal move to the right, a small vertical move up, and a diagonal move to the upper right corner. The corresponding code might look like this:

Start on green flag, move right 6 times, move up two times, send message. Start on message, move right 4 times. Start on message, move right 4 times.


This code contains two simultaneous starting situations, that is, the reception of the message which is symbolized by the orange envelope.