Programming in the Application

Game Objective

The objective of the game is to guide Kodi to the finish line. To solve the board and get the hero to the finish line, you need to arrange the correct sequence of code. By clicking on the icon on the board, you can check what action needs to be performed on a given field. Apply the appropriate programming construct in your algorithm using the appropriate block.

Counting Steps

To check the number of steps Kodi has to perform, click on the ruler icon, then select the desired fields on the board.

Actions

During the game, Kodi's task is to collect various items that will be needed to perform tasks - actions on the board. Items collected go temporarily into the inventory. At any time, you can use the collected items by applying the "Use" action. In the case of multiple heroes on the board, each of them has a separate inventory where the items collected by them are stored.

Conditional Instructions

The conditional block allows an action to be performed only in certain cases, e.g., Kodi will perform the "collect" action only if a coin is hidden under the question mark.

Iterative Loops

The counter loop block repeats any number of times the commands that are in it, e.g., step up and step right.

Nested Loops

Nested loops involve placing one loop inside another.

Conditional Loops

The conditional loop block repeats the commands contained in it until a certain condition is met, e.g., Kodi is on a field with a spider web.

Variables

The variable block is a kind of "box" in which we can store a value and then refer to it in the code.

Functions

Functions allow for the reuse of the same commands in different parts of the code. If there are sets of commands that you often use, you can save them as additional functions.

Events

Events are an element of concurrent programming. During the game, we have the opportunity to create many events that will be executed at the same time on the board. In the case of more than one hero on the board, there may be a need for them to perform actions at the same time. For example, the Elf must press the button that opens the teleport so that Kodi in another part of the board can enter it. Events also give the opportunity to set different reasons for their execution. We can trigger events with the press of the play button, when the hero receives a message, or after a certain time has passed.

Multiple Heroes on the Board

Sequential Programming

When we solve a problem in which we can predict all situations that may occur and solve the task in the form of sequentially following program instructions, then the most basic technique is to write down all the activities that must follow each other. This procedure is called creating a sequence of code instructions, in short, creating a sequence. In the example below, instructions for two heroes are included in one sequence and are executed in turn.

Concurrent Programming

In concurrent programming, two or more sequences of instructions are executed in parallel. On the board, we control two or three heroes at the same time, perform different Actions and handle Events, and for each of the heroes, there is a separate sequence. It is necessary to synchronize the movement of all characters to enable Kodi to reach the finish line first. The concept of clock cycle comes into play here. For each board where concurrent programming can be used, a maximum number of cycles is specified. Each action/condition check is one clock cycle.