Terrain Color: Difference between revisions
(updates from Blockument) |
(Marked this version for translation) |
||
Line 23: | Line 23: | ||
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. | 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== | ==Example== <!--T:9--> | ||
<!--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:terrain_color_example.png|alt=Terrain Color example code|thumb]] | ||
<!--T:11--> | |||
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. | 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. | ||
<!--T:12--> | |||
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. | 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. | ||
Revision as of 19:00, 11 August 2023
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.