Updated: Aug 18
In our previous blog post "Can you meet the curriculum requirements by playing a mobile game? We think so." we broke down the four core concepts within computer sciences that are also within the new Ontario middle school public education curriculum (grades 6-8).
This week, we're going to show you how those concepts are addressed within our game, Super Code Strike; beginning with Control Flow and Algorithms which are covered in grade 6. Control Flow is the order in which individual statements, instructions or function calls run. Algorithms or efficient Algorithms are the break down of activity into a sequence of instructions to solve a specific problem.
The second two concepts introduced last week were Computer Memory and Data Types and Structures. These two concepts are more complex than the two aforementioned, and they makeup the curriculum requirements for grades 7 and 8. Computer Memory refers to the space where the instructions for a program, and data to be processed are stored and retrieved from; and Data Types and Structures refers to how you can input, process, retrieve and maintain information.
Managing control flow involves writing code that includes conditional statements or control structures. Examples of control flow statements include: loops, and decision-making statements (including if-statements). The below video shows an example using block based programming. The code clearly lays out instructions for the bear robot to follow if the striker hits a trigger. The code includes a loop "repeat forever", multiple variables, and multiple "if statements". Based on the code presented, when the trigger associated with this bear robot is hit, the robot will patrol until its radar detects an enemy player (the striker). When an enemy player is detected, the robot will turn to face the player and then attack. That action will repeat as long as the enemy is detected by the bear robots radar. Otherwise, it will turn left and continue to patrol.
In computer programming, algorithms themselves are sets of instructions designed to complete specific tasks or sets of tasks. An algorithm may contain a function, these functions serve as small programs that can be referenced by a larger program. Every time a player codes instructions for one of their robots to follow, they are working with algorithms. The below video shows an example using block based programming to detonate an SCS C4 element on a timer. As you'll see, the instructions are simple: once the trigger connected to the C4 is hit, wait 5 seconds and then explode.
The program memory within this example refers to both “Clipboard 1" and “Clipboard 2” which are set to receive, store and transmit in-game data which is then used by other programs. Both Clipboards are used to store information from moveable platforms, which then determines the changing colours of each platform and collects, and stores points based on the players actions.
Clipboard 1 is set to "false" on start, it is connected to the "Moving Light Platform". When the player is standing on that platform, Clipboard 1 gets set to "true" and the other platforms will flash different colours in response. At the same time, Clipboard 2 is set to zero, and the value increases in increments of 1 based on whether or not the player is standing on the "Moving Light Platform" for 2 seconds (= 1 colour switch). As the value of Clipboard 2 increases, the exit zone will continue to check that value and once it is greater than 7, the exit zone will turn on and the player can finish the level.
Below is a video of the complete program being built, and running.
Data Types and Structures
In this example, the first program you see is the the Fyrefox program. It is simply designed to attack the Striker. The second program shown is for the Crone. It shows how two different types of data are recorded, processed and reflected within the game. In Super Code Strike the Crone can be programmed to display custom messages to the striker. The messages can be static (one statement that does not change) or reflective of whats going on while the player is striking. In this example, the program combines two types of data (text string + dynamic integer). The dynamic integer within the message is set to reflect the number of robots remaining which will inevitably change as the player destroys them. As a result, the Crone will display a message that is updated every time a robot is destroyed.
Interested in becoming a beta tester for Super Code Strike? Sign up to participate here: SCS Beta Testing