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
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.