Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CZ/docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[Externí Editor](docs/external_editor.md) [První program](docs/first_program.md) [Začínáme](docs/getting_started.md) [Nahrát Zálohu](docs/backup.md) <unlock=debug>[Výstup](docs/output.md) </unlock>[1.0 je konečně zde!](docs/patchnotes.md) <unlock=debug>[Statistiky](docs/stats.md) </unlock> [Autoři a poděkování](docs/credits.md)

## {{@table_of_contents_section_programming}}
<unlock=break>[Break](docs/scripting/break.md) </unlock><unlock=debug>[Debug](docs/scripting/debug.md) </unlock>[Komentáře](docs/scripting/comments.md) <unlock=continue>[Pokračovat](docs/scripting/continue.md) </unlock><unlock=dicts>[Slovníky](docs/scripting/dicts.md) </unlock><unlock=for>[For Loop](docs/scripting/for.md) </unlock><unlock=functions>[Funkce](docs/scripting/functions.md) </unlock><unlock=if>[If](docs/scripting/if.md) </unlock><unlock=import>[Import](docs/scripting/import.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=operators>[Operátoři](docs/scripting/operators.md) </unlock><unlock=functions>[Name Scopes](docs/scripting/scopes.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md) </unlock><unlock=functions>[Tuples](docs/scripting/tuples.md) </unlock><unlock=variables>[Proměnné](docs/scripting/variables.md) </unlock><unlock=while>[While Loop](docs/scripting/while.md) </unlock>
<unlock=break>[Break](docs/scripting/break.md) </unlock><unlock=debug>[Debug](docs/scripting/debug.md) </unlock>[Komentáře](docs/scripting/comments.md) <unlock=continue>[Pokračovat](docs/scripting/continue.md) </unlock><unlock=dicts>[Slovníky](docs/scripting/dicts.md) </unlock><unlock=for>[For Loop](docs/scripting/for.md) </unlock><unlock=functions>[Funkce](docs/scripting/functions.md) </unlock><unlock=if>[If](docs/scripting/if.md) </unlock><unlock=variables>[In](docs/scripting/in.md) </unlock><unlock=import>[Import](docs/scripting/import.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=operators>[Operátoři](docs/scripting/operators.md) </unlock><unlock=functions>[Name Scopes](docs/scripting/scopes.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md) </unlock><unlock=variables>[Tuples](docs/scripting/tuples.md) </unlock><unlock=variables>[Proměnné](docs/scripting/variables.md) </unlock><unlock=while>[While Loop](docs/scripting/while.md) </unlock>

## {{@table_of_contents_section_unlocks}}
{{unlocksTOC}}
Expand Down
2 changes: 1 addition & 1 deletion CZ/docs/scripting/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Cyklus `for` vypadá takto:
`variable_name` může být libovolný název. Je to proměnná, která uchovává aktuální prvek sekvence. `sequence` musí být hodnota, přes kterou lze iterovat, například rozsah čísel. Blok kódu se vykoná pro každý prvek s přiřazenou proměnnou cyklu.

## Sequences
[Ranges](functions/range) <unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=functions>[Tuples](docs/scripting/tuples.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>
[Ranges](functions/range) <unlock=variables>[Tuples](docs/scripting/tuples.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>

## Example
`for i in range(5):
Expand Down
57 changes: 57 additions & 0 deletions CZ/docs/scripting/in.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# In Statement

You can use an `in` statement to check if a value is available within a `sequence` or a string of characters. A `sequence` needs to be some value that can be iterated over like a range of numbers. If the value is in the `sequence` then then the statement will return `True` and if it is not then it will return `False`.

<unlock=dict>
You can also use an `in` statement with a dict or set. When used with a dict it will search for a value in the dict's keys.</unlock>
Note: When used in a `for` loop the `in` keyword functions differently. Please see [For Loop](docs/scripting/for.md) to learn about how to use the `in` keyword for those.

## Syntax

An `in` statement looks like this:

`variable_name = variable_name_or_value in sequence`

`variable_name` can be any name you choose and will be given the value of `True` or `False`

Or:

`if variable_name_or_value in sequence:
# code block`

Or:

`while variable_name_or_value in sequence:
# code block`

`variable_name_or_value` can be any variable you want or any value you want. `sequence` must be one of the things listed below, or a string of characters. An `if` or `while` code block will run if the value is in the provided sequence.

## Sequences

[Ranges](functions/range) <unlock=variables>[Tuples](docs/scripting/tuples.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>

## Example - 2x2 Square of Bushes

`clear()
for x in range(get_world_size()):
for y in range(get_world_size()):

if x in (0, 1) and y in (0, 1):
plant(Entities.Bush)

move(North)
move(East)`

This will plant a square of `Entities.Bush` in a 2x2 square starting at the origin (0, 0) of the world leaving the rest untouched.
<unlock=senses>

## Example - Tilling

`desired_entity = Entities.Carrot
entities_needing_soil = (Entities.Pumpkin, Entities.Carrot)

if desired_entity in entities_needing_soil:
if get_ground_type() != Grounds.Soil:
till()`

This will check if the `desired_entity` is in the `tuple` `entities_needing_soil` so that the drone can know if it needs to check if the current ground type is `Grounds.Soil`. If it is not then it will call the `till` function to change the ground type.</unlock>
2 changes: 1 addition & 1 deletion DE/docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[Externer Editor](docs/external_editor.md) [Erstes Programm](docs/first_program.md) [Erste Schritte](docs/getting_started.md) [Laden von Backups](docs/backup.md) <unlock=debug>[Output](docs/output.md) </unlock><unlock=debug>[Statistiken](docs/stats.md) </unlock> [Credits](docs/credits.md)

## {{@table_of_contents_section_programming}}
<unlock=break>[Break](docs/scripting/break.md) </unlock><unlock=debug>[Debug](docs/scripting/debug.md) </unlock>[Kommentare](docs/scripting/comments.md) <unlock=continue>[Continue](docs/scripting/continue.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=for>[For-Schleife](docs/scripting/for.md) </unlock><unlock=functions>[Funktionen](docs/scripting/functions.md) </unlock><unlock=if>[If](docs/scripting/if.md) </unlock><unlock=import>[Import](docs/scripting/import.md) </unlock><unlock=lists>[Listen](docs/scripting/lists.md) </unlock><unlock=operators>[Operatoren](docs/scripting/operators.md) </unlock><unlock=functions>[Namensbereiche (Scopes)](docs/scripting/scopes.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md) </unlock><unlock=functions>[Tupel](docs/scripting/tuples.md) </unlock><unlock=variables>[Variablen](docs/scripting/variables.md) </unlock><unlock=while>[While-Schleife](docs/scripting/while.md) </unlock>
<unlock=break>[Break](docs/scripting/break.md) </unlock><unlock=debug>[Debug](docs/scripting/debug.md) </unlock>[Kommentare](docs/scripting/comments.md) <unlock=continue>[Continue](docs/scripting/continue.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=for>[For-Schleife](docs/scripting/for.md) </unlock><unlock=functions>[Funktionen](docs/scripting/functions.md) </unlock><unlock=if>[If](docs/scripting/if.md) </unlock><unlock=variables>[In](docs/scripting/in.md) </unlock><unlock=import>[Import](docs/scripting/import.md) </unlock><unlock=lists>[Listen](docs/scripting/lists.md) </unlock><unlock=operators>[Operatoren](docs/scripting/operators.md) </unlock><unlock=functions>[Namensbereiche (Scopes)](docs/scripting/scopes.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md) </unlock><unlock=variables>[Tupel](docs/scripting/tuples.md) </unlock><unlock=variables>[Variablen](docs/scripting/variables.md) </unlock><unlock=while>[While-Schleife](docs/scripting/while.md) </unlock>

## {{@table_of_contents_section_unlocks}}
{{unlocksTOC}}
Expand Down
2 changes: 1 addition & 1 deletion DE/docs/scripting/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Eine for-Schleife sieht so aus:
`variablen_name` kann jeder Name sein, den du wählst. Es ist eine Variable, die das aktuelle Element in der Sequenz speichert. `sequenz` muss ein Wert sein, der durchlaufen werden kann, wie ein Bereich von Zahlen. Der Codeblock wird für jedes Element ausgeführt, wobei die Schleifenvariable diesem Element zugewiesen ist.

## Sequenzen
[Ranges](functions/range) <unlock=lists>[Listen](docs/scripting/lists.md) </unlock><unlock=functions>[Tupel](docs/scripting/tuples.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>
[Ranges](functions/range) <unlock=variables>[Tupel](docs/scripting/tuples.md) </unlock><unlock=lists>[Listen](docs/scripting/lists.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>

## Beispiel
`for i in range(5):
Expand Down
57 changes: 57 additions & 0 deletions DE/docs/scripting/in.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# In Statement

You can use an `in` statement to check if a value is available within a `sequence` or a string of characters. A `sequence` needs to be some value that can be iterated over like a range of numbers. If the value is in the `sequence` then then the statement will return `True` and if it is not then it will return `False`.

<unlock=dict>
You can also use an `in` statement with a dict or set. When used with a dict it will search for a value in the dict's keys.</unlock>
Note: When used in a `for` loop the `in` keyword functions differently. Please see [For Loop](docs/scripting/for.md) to learn about how to use the `in` keyword for those.

## Syntax

An `in` statement looks like this:

`variable_name = variable_name_or_value in sequence`

`variable_name` can be any name you choose and will be given the value of `True` or `False`

Or:

`if variable_name_or_value in sequence:
# code block`

Or:

`while variable_name_or_value in sequence:
# code block`

`variable_name_or_value` can be any variable you want or any value you want. `sequence` must be one of the things listed below, or a string of characters. An `if` or `while` code block will run if the value is in the provided sequence.

## Sequenzen

[Ranges](functions/range) <unlock=variables>[Tupel](docs/scripting/tuples.md) </unlock><unlock=lists>[Listen](docs/scripting/lists.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>

## Example - 2x2 Square of Bushes

`clear()
for x in range(get_world_size()):
for y in range(get_world_size()):

if x in (0, 1) and y in (0, 1):
plant(Entities.Bush)

move(North)
move(East)`

This will plant a square of `Entities.Bush` in a 2x2 square starting at the origin (0, 0) of the world leaving the rest untouched.
<unlock=senses>

## Example - Tilling

`desired_entity = Entities.Carrot
entities_needing_soil = (Entities.Pumpkin, Entities.Carrot)

if desired_entity in entities_needing_soil:
if get_ground_type() != Grounds.Soil:
till()`

This will check if the `desired_entity` is in the `tuple` `entities_needing_soil` so that the drone can know if it needs to check if the current ground type is `Grounds.Soil`. If it is not then it will call the `till` function to change the ground type.</unlock>
2 changes: 1 addition & 1 deletion EN/docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[External Editor](docs/external_editor.md) [First Program](docs/first_program.md) [Getting Started](docs/getting_started.md) [Loading Backups](docs/backup.md) <unlock=debug>[Output](docs/output.md) </unlock><unlock=debug>[Stats](docs/stats.md) </unlock> [Credits](docs/credits.md)

## {{@table_of_contents_section_programming}}
<unlock=break>[Break](docs/scripting/break.md) </unlock><unlock=debug>[Debug](docs/scripting/debug.md) </unlock>[Comments](docs/scripting/comments.md) <unlock=continue>[Continue](docs/scripting/continue.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=for>[For Loop](docs/scripting/for.md) </unlock><unlock=functions>[Functions](docs/scripting/functions.md) </unlock><unlock=if>[If](docs/scripting/if.md) </unlock><unlock=import>[Import](docs/scripting/import.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=operators>[Operators](docs/scripting/operators.md) </unlock><unlock=functions>[Name Scopes](docs/scripting/scopes.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md) </unlock><unlock=functions>[Tuples](docs/scripting/tuples.md) </unlock><unlock=variables>[Variables](docs/scripting/variables.md) </unlock><unlock=while>[While Loop](docs/scripting/while.md) </unlock>
<unlock=break>[Break](docs/scripting/break.md) </unlock><unlock=debug>[Debug](docs/scripting/debug.md) </unlock>[Comments](docs/scripting/comments.md) <unlock=continue>[Continue](docs/scripting/continue.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=for>[For Loop](docs/scripting/for.md) </unlock><unlock=functions>[Functions](docs/scripting/functions.md) </unlock><unlock=if>[If](docs/scripting/if.md) </unlock><unlock=variables>[In](docs/scripting/in.md) </unlock><unlock=import>[Import](docs/scripting/import.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=operators>[Operators](docs/scripting/operators.md) </unlock><unlock=functions>[Name Scopes](docs/scripting/scopes.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md) </unlock><unlock=variables>[Tuples](docs/scripting/tuples.md) </unlock><unlock=variables>[Variables](docs/scripting/variables.md) </unlock><unlock=while>[While Loop](docs/scripting/while.md) </unlock>

## {{@table_of_contents_section_unlocks}}
{{unlocksTOC}}
Expand Down
2 changes: 1 addition & 1 deletion EN/docs/scripting/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A for loop looks like this:
`variable_name` can be any name you choose. It is a variable that stores the current element in the sequence. `sequence` needs to be some value that can be iterated like a range of numbers. The code block is executed for every element with the loop variable assigned to that element.

## Sequences
[Ranges](functions/range) <unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=functions>[Tuples](docs/scripting/tuples.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>
[Ranges](functions/range) <unlock=variables>[Tuples](docs/scripting/tuples.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>

## Example
`for i in range(5):
Expand Down
56 changes: 56 additions & 0 deletions EN/docs/scripting/in.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# In Statement

You can use an `in` statement to check if a value is available within a `sequence` or a string of characters. A `sequence` needs to be some value that can be iterated over like a range of numbers. If the value is in the `sequence` then then the statement will return `True` and if it is not then it will return `False`.
<unlock=dict>
You can also use an `in` statement with a dict or set. When used with a dict it will search for a value in the dict's keys.</unlock>
Note: When used in a `for` loop the `in` keyword functions differently. Please see [For Loop](docs/scripting/for.md) to learn about how to use the `in` keyword for those.

## Syntax

An `in` statement looks like this:

`variable_name = variable_name_or_value in sequence`

`variable_name` can be any name you choose and will be given the value of `True` or `False`

Or:

`if variable_name_or_value in sequence:
# code block`

Or:

`while variable_name_or_value in sequence:
# code block`

`variable_name_or_value` can be any variable you want or any value you want. `sequence` must be one of the things listed below, or a string of characters. An `if` or `while` code block will run if the value is in the provided sequence.

## Sequences

[Ranges](functions/range) <unlock=variables>[Tuples](docs/scripting/tuples.md) </unlock><unlock=lists>[Lists](docs/scripting/lists.md) </unlock><unlock=dicts>[Dictionaries](docs/scripting/dicts.md) </unlock><unlock=sets>[Sets](docs/scripting/sets.md)</unlock>

## Example - 2x2 Square of Bushes

`clear()
for x in range(get_world_size()):
for y in range(get_world_size()):

if x in (0, 1) and y in (0, 1):
plant(Entities.Bush)

move(North)
move(East)`

This will plant a square of `Entities.Bush` in a 2x2 square starting at the origin (0, 0) of the world leaving the rest untouched.
<unlock=senses>

## Example - Tilling

`desired_entity = Entities.Carrot
entities_needing_soil = (Entities.Pumpkin, Entities.Carrot)

if desired_entity in entities_needing_soil:
if get_ground_type() != Grounds.Soil:
till()`

This will check if the `desired_entity` is in the `tuple` `entities_needing_soil` so that the drone can know if it needs to check if the current ground type is `Grounds.Soil`. If it is not then it will call the `till` function to change the ground type.</unlock>
6 changes: 6 additions & 0 deletions EN/docs/scripting/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ for number in numbers:
sum += number`
`sum` is now `18`

You can also check if a value exists in a list. The following example checks to see if `6` is in `numbers`:

`numbers = [8, 6, 1, 10]
if 6 in numbers:
do_a_flip()`

The following list methods allow you to add and remove elements:

`elements.append(elem)` adds an element to the end of the list:
Expand Down
18 changes: 15 additions & 3 deletions EN/docs/scripting/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
arithmetic operators: `+, -, *, /, //, %, **`
comparison operators: `==, !=, <=, >=, <, >`
boolean operators: `not, and, or`
<unlock=variables>existence operator: `in`</unlock>

Note: All numbers in the game are floating point numbers. So all arithmetic operators are floating point operators.
`//` is defined to just floor the number after the division.

For assignment operators you need to unlock the "Variables" unlock.

## Introduction
Operators allow you to compare, modify and combine values.
The arithmetic operators `+, -, *, /, //, %, **` are used to perform common mathematical operations on numbers.
Operators allow you to compare, modify and combine values.
The arithmetic operators `+, -, *, /, //, %, **` are used to perform common mathematical operations on numbers.
The comparison operators `==, !=, <=, >=, <, >` are used to compare values. The result is always either `True` or `False`.
The logic operators (also called boolean operators) `not, and, or` are used to combine truth values.

Expand Down Expand Up @@ -72,4 +73,15 @@ The logic operators (also called boolean operators) `not, and, or` are used to c

`True or True` evaluates to `True`
`True or False` evaluates to `True`
`False or False` evaluates to `False`
`False or False` evaluates to `False`
<unlock=variables>
## Existence Operator

`in` can only be used with sequences and checks to see if a value is in that sequence.

`1 in (1, 2)` evaluates to `True`
`not 3 in (1, 2)` evaluates to `True`
`3 not in (1, 2)` evaluates to `True`
`"Goodbye" in "Hello World"` evaluates to `False`
`not "Goodbye" in "Hello World"` evaluates to `True`
`"Goodbye" not in "Hello World"` evaluates to `True`</unlock>
Loading