Terrain Color: Difference between revisions

From StarLogo Nova Wiki
(Marked this version for translation)
(duplicate file already uploaded)
 
Line 27: Line 27:
<!--T:10-->
<!--T:10-->
[[File:terrain_color_example.gif|alt=Terrain Color example gif|thumb]]
[[File:terrain_color_example.gif|alt=Terrain Color example gif|thumb]]
[[File:terrain_color_example.png|alt=Terrain Color example code|thumb]]
[[File:and_example.png|alt=Terrain Color example code|thumb]]


<!--T:11-->
<!--T:11-->

Latest revision as of 15:39, 16 August 2023

Other languages:


Terrain color

Returns the color of the terrain the agent is currently on.

terrain color is a code block part of the Environment drawer.

Usage

terrain color refers to the color of the terrain that the agent is currently on.

Syntax

[Textbox Insert] terrain color

Common Uses

This is commonly used as part of a conditional statement: for example, if an agent's color matches the color of the terrain, then the agent should perform a certain action.

Example

Terrain Color example code

This is a model of a quarantine. Doctors (pink cubes) find sick agents roaming around the unquarantined area (green terrain) and move them to the quarantine (white terrain). Further, they also remove immune agents (blue) from the quarantine and move them to the unquarantined area. Note that movement from the unquarantined area to the quarantined area changes the trait quarantined? from 0 to 1.

The blocks shown above describe the procedure that ensures quarantined agents remain on white terrain and unquarantined agents remain on green terrain. If this condition is violated, the procedure bounce is called to move the agents back into its correct position.

Nuances

Related Blocks