synopsis

prerequisite

No prerequisite is needed to read this tutorial, except the Algois app on your device ;-)

basics

What is a program?
A computer program is a sequence of written instructions that tell a computer to do things for us.
When I was little, I thought it was sufficient to talk to the computer to ask it do things.
Many people would love this to happen so there is a lot of effort in this direction.
But for now we have to settle for using programming languages that a computer can interpret.
The sequence of instructions that you write is called source code.
Therefore the programmer must imagine the process involved and then write the source code of the program.
After writing, the program is executed by the machine and it does what the programmer wanted it to do (most of the time!).
In AL, lines of code are usually separated by a semi-colon symbol ";" but it is not mandatory.
It is good practice to separate your lines of code with a carriage return too.

This is an example of an AL programm:┬á

1

2

3

algo.go(100);algo.turnRight(90);algo.go(100);

Note: To execute the program touch menu / run.
You can disable the step by step mode by touching the menu / execution / step by step.

moving and environment

The Algoid turtle can move forwards in relative mode: it moves from the current position along its current orientation for the required distance.
In our previous example, the turtle was oriented to the top of the screen at position 0, 0 (at the center of the algoid screen).
We move the turtle foreward with the instruction algo.go (100), and when the turtle executes this it moves up to coordinates 0, 100.

rotation

The turtle can also rotate in relative mode. The new orientation is determined by adding the angle turned to the current orientation.
In our previous example, the turtle's initial orientation was 0┬░ and we told it to turn right through a 90┬░ angle.
All angles are between 0┬░ and 360┬░, where 360┬░ is a complete turn around and corresponds to 0┬░.
This image demonstrates the different orientations achieved using the instruction algo.turnRight ():The algo.turnLeft () does the same thing but in reverse, so the angles are reversed on the wheel:So the simplest approach is usually to use the both functions; algo.turnRight () and algo.turnLeft () between 0┬░ and 180┬░:

relativity

Eur├¬ka! Everything is relative!
The relative way to determine the position of a point in space is called euclidean space.
Each time the turtle is moved and rotated, its reference changes and that will affect its future position.
For example, if the turtle has already been rotated to 45┬░ with algo.turnRight () function, its new orientation will be: