Difference between revisions of "Next-to Condition"

From AgentCubes
Jump to navigation Jump to search
imported>Andri
imported>Andri
Line 13: Line 13:
 
<tr>
 
<tr>
 
<td align="left" valign="top" width="80"><b>Example:</b></td>
 
<td align="left" valign="top" width="80"><b>Example:</b></td>
<td align="left" valign="top" width="100%"> The Person agent in the Virus Attack project checks if it is next to one or more sick Person agents. If so, it has a 5% chance of acquiring the virus.  
+
<td align="left" valign="top" width="100%"> The Particle agent in the Accretion 3D project checks if it is next to at least one stationery Particle in the same layer or in the layers above (+1) or below (-1). If so, it changes itself to be a stationery Particle, increments a count and maps its color to a shade, based on the current count of stationery particles.  
 
[[Image:Next to condition example.png|500px]]</td>
 
[[Image:Next to condition example.png|500px]]</td>
 
</tr>
 
</tr>

Revision as of 18:02, 17 June 2011

Next to condition.png

Definition: The Next-to condition checks to see how many of the 8 adjacent neighbors in the same layer have a certain shape. If the agent is next to the right number of the specified shapes, the condition is true. Otherwise, the condition is false.
Parameters: comparator, formula, shape
Example: The Particle agent in the Accretion 3D project checks if it is next to at least one stationery Particle in the same layer or in the layers above (+1) or below (-1). If so, it changes itself to be a stationery Particle, increments a count and maps its color to a shade, based on the current count of stationery particles. Next to condition example.png