-
Introduction
In this section you will learn about the strategy we have followed to teach our students programming in a simple and fun way. Learning to code can be a motivating activity.
-
The DEMETER I language
In this section you will learn about the basic structures of our programming language. We call this set of instructions DEMETER I.
-
The DEMETER II language
In this section you will learn about the evolution of the initial DEMETER I instruction set. We will call the full language DEMETER II. In addition to having new instructions, the minefields have new elements that increase the difficulty.
The alternative instruction. IF MINE and IF BLOCK
To use conditional structures we have invented a new element: mystery squares. In them there may be an obstacle or a mine. The robot will only know it if it executes a conditional IF statement.
Please note: Mystery squares will appear like a question mark “?” in the minefields on the website.
Besides, if we want to count how many mines there are in the minefield now, we will have to use the alternative IF statement for sure. The syntax of this instruction in the DEMETER II language is the following:
IF MINE NEXT THEN
[some instructions]
END IF
Action: The rover will execute the instructions only if it has a mine in front of it.
The rover will also have the following instruction:
IF BLOCK THEN
[some instructions]
END IF
Action: The rover will execute the instructions only if something is in front of it to block it.
With these instructions, the rover will be able to perform the following exercise:
The solution to this exercise is the following one:
MINES = 0
STEPS = 0
A
STEPS++
TR
A
STEPS++
TL
A
STEPS++
TL
FOR 9
IF MINE THEN
DEACT
MINES++
END
TR
A
STEPS++
TL
ENDFOR 12
A
STEPS++
END
TR
A
STEPS++PRINT MINES
PRINT STEPS
Important: if you want to use our class documentation (exercises) you can download it from the following link:
LEARN 2 PROGRAM SLIDES