Difference between revisions of "See-a Condition"

From AgentCubes
Jump to navigation Jump to search
imported>Andri
imported>Andri
Line 1: Line 1:
 +
[[image:See-a-condition.png|150px]]
  
 +
[[image:See-a-condition-additional-params.png|150px]]
 +
<table cellpadding="10" cellspacing="0" border="0" width="100%">
 +
<tr>
 +
<td align="left" valign="top" width="80"><b>Definition:</b></td>
 +
<td align="left" valign="top" width="100%">The <strong>See-A</strong> condition checks if the agent at the cell indicated by the [[Direction parameter]] is of the class specified in the [[Agent Class Name parameter]]. If the cell in the indicated direction contains an agent of the specified class, the See-a condition is true. Otherwise, the condition is false. In contrast to the [[See Condition]], the See-a condition picks out all the shapes of a given agent. Use it to identify an agent regardless of the way it looks. </td>
 +
</tr>
 +
<tr>
 +
<td align="left" valign="top" width="80"><b>Parameters:</b></td>
 +
<td align="left" valign="top" width="100%">[[Direction parameter|direction]], [[Shape parameter|shape]] </td>
 +
</tr>
 +
<tr>
 +
<td align="left" valign="top" width="80"><b>Optional Parameters:</b></td>
 +
<td align="left" valign="top" width="100%">[[Layer parameter]]: the See condition can check to see if the specified shape exists in a layer other than the current layer the agent resides on.</td>
 +
</tr>
 +
 +
<tr>
 +
<td align="left" valign="top" width="80"><b>Example 1:</b></td>
 +
<td align="left" valign="top" width="100%"><b>same layer:</b>If the Tree agent in the Forest Fire simulation is currently a burning tree (i.e. sees itself as a burning tree shape), with a 50% chance (the die out probability for the fire) changes itself to a burnt tree, incremetns the burnt tree count (the simulation property called "Burnt_Trees") and calculates the percentage of burnt trees in the forest.
 +
[[Image:See Condition Example.png|500px]]</td>
 +
</tr>
 +
 +
<tr>
 +
<td align="left" valign="top" width="80"><b>Example 2: </b></td>
 +
<td align="left" valign="top" width="100%"><b>different layer:</b>In its "remove above" method, if the Nebuchadnezzar agent in the 3D Matrix game sees a Matrix shame in the layer above it, it plays the Whip sound, removes the Matrix (erases the agent in the same x,y position, but the layer above it) and replaces it with a Hole agent.<BR>
 +
[[Image:See condition example 2.png|500px]]</td>
 +
</tr>
 +
</table>
  
 
[[Category:AgentCubes_Conditions]]
 
[[Category:AgentCubes_Conditions]]

Revision as of 16:41, 17 June 2011

150px

150px

Definition: The See-A condition checks if the agent at the cell indicated by the Direction parameter is of the class specified in the Agent Class Name parameter. If the cell in the indicated direction contains an agent of the specified class, the See-a condition is true. Otherwise, the condition is false. In contrast to the See Condition, the See-a condition picks out all the shapes of a given agent. Use it to identify an agent regardless of the way it looks.
Parameters: direction, shape
Optional Parameters: Layer parameter: the See condition can check to see if the specified shape exists in a layer other than the current layer the agent resides on.
Example 1: same layer:If the Tree agent in the Forest Fire simulation is currently a burning tree (i.e. sees itself as a burning tree shape), with a 50% chance (the die out probability for the fire) changes itself to a burnt tree, incremetns the burnt tree count (the simulation property called "Burnt_Trees") and calculates the percentage of burnt trees in the forest. See Condition Example.png
Example 2: different layer:In its "remove above" method, if the Nebuchadnezzar agent in the 3D Matrix game sees a Matrix shame in the layer above it, it plays the Whip sound, removes the Matrix (erases the agent in the same x,y position, but the layer above it) and replaces it with a Hole agent.
See condition example 2.png