Terrain Color: Difference between revisions
No edit summary |
(duplicate file already uploaded) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
<translate> | |||
<!--T:1--> | |||
<section begin=image/> | <section begin=image/> | ||
[[File:Terrain color.png|alt=Terrain color|thumb]] | [[File:Terrain color.png|alt=Terrain color|thumb]] | ||
<section end=image/> | <section end=image/><p id="tooltip">Returns the color of the terrain the agent is currently on.</p> | ||
<!--T:8--> | |||
<section begin="name" />'''<code>terrain color</code>'''<section end="name" /> is a [[code block]] part of the [[Environment]] drawer. | <section begin="name" />'''<code>terrain color</code>'''<section end="name" /> is a [[code block]] part of the [[Environment]] drawer. | ||
== Usage== | <!--T:2--> | ||
==Usage== | |||
<code>terrain color</code> refers to the color of the terrain that the [[agent]] is currently on. | |||
==Syntax== <!--T:3--> | |||
<code>terrain color</code> | <!--T:4--> | ||
<code>[Textbox Insert] terrain color</code> | |||
<!--T:5--> | |||
==Common Uses== | ==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. | 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. | ||
==Nuances== | ==Example== <!--T:9--> | ||
<!--T:10--> | |||
[[File:terrain_color_example.gif|alt=Terrain Color example gif|thumb]] | |||
[[File:and_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. | |||
<!--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. | |||
==Nuances== <!--T:6--> | |||
<!--T:7--> | |||
==Related Blocks== | ==Related Blocks== | ||
[[Category:Environment]] | [[Category:Environment]] | ||
[[Category:Code Block]] | [[Category:Code Block]] | ||
</translate> |
Latest revision as of 15:39, 16 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.