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: Computational Problem Solving


Coding can be used to automate tasks and to represent and solve problems. 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 mathematical learning tool to represent and manipulate complex mathematical situations.

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

When the code for the sprite and the lyrics are executed at the same time, they are considered concurrent events. If the code of the sprite was executed first and then the lyrics, they are considered to be sequential events.

Skill: Writing Code


Writing and altering a code involves sequencing 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 no particular program language.

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


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:

Possible purple butterfly code:

Skill: Executing Code


Execution of code is when the code pattern is read and compiled by the coding program and is referred to as the output. 

Some examples of run buttons for block coding programs include:

Source: Microbit.

Source: Scratch.

Knowledge: Simultaneous Events


Simultaneous events are 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:

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:


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