LEARNING TO THINK PROGRAMMATICALLY AS AN EVERYDAY SKILL

Learning to code may not be for everyone, but as technology continues to reach deeper into our lives, an ability to understand and participate in it has become increasingly important.

But more than that, programmatic thinking offers tools for strategizing, problem-solving and creativity that can be useful in everyday life.

This is why DUAL was created.

WHAT DO PLAYERS LEARN?

Many computer programs are built with three common patterns: selection, sequence and loop. Playing DUAL introduces all of these concepts.

SELECTION

When you use conditions you're testing to see if shapes on the grid return TRUE or FALSE. If a shape matches the condition, it will return TRUE. If it doesn't match, it returns FALSE. In code these are called conditional statements.

You can see how these work in the game below.

IF SHAPE ROW IS EQUAL TO 0 THEN RETURN TRUE

During each step of the sequence, the program loops through the shapes on the grid and checks which return TRUE. Shapes that pass these 'tests' are grouped and targeted by whichever action the player chose. Shapes that return false are faded out. See below for more about sequences and loops.

When you use the AND / OR logic in the game, you're using logical operators.

With AND between two conditions, the program returns TRUE if both conditions are met. With OR the program returns TRUE if either condition is met. Consider what this would mean if you combined two of the above conditional statements.

SEQUENCE

A program reads code in sequential order, responding to changing states as it goes along. This is exactly how sequences work in the game!

SHAPES EQUAL TO ROTATE TO
SHAPES EQUAL TO SWITCH TO
SHAPES EQUAL TO SWITCH TO

The program reads the code from top to bottom. After the first condition is tested and the first action is taken, the program moves to the next step. At this point the next condition is tested, but the shapes on the grid have now changed. Being able to anticipate such changes and plan ahead is key to playing the game – and key to being good at programming.

LOOPS

When you hit play, the program loops through every shape on the grid: first to check if each shape meets your set of conditions and then to perform each action in your sequence.

Let's see what the loop returns for the conditions below.


TRUE

Loops are used all the time in programming to go systematically through a set of items or objects. Sometimes this is to find things, or test conditions like above. Sometimes it's to collect or change things. Computers are great at repetitive tasks that people would find boring.