Difference between revisions of "Next-to Condition"

From AgentCubes
Jump to navigation Jump to search
imported>Andri
imported>Corrina
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[image:See a condition.png|150px]]
+
[[Image:Next to condition.png|150px|Next to condition.png]]  
  
[[image:See a condition additional params.png|150px]]
+
[[Image:Next to expanded.png|150px|Next to expanded.png]]  
<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]], [[Agent Class Name parameter|agent class name]] </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-a condition can check to see if the specified agent exists in a layer other than the current layer the agent resides on.</td>
 
</tr>
 
  
<tr>
+
{| cellpadding="10" cellspacing="0" border="0" width="100%"
<td align="left" valign="top" width="80"><b>Example:</b></td>
+
|-
<td align="left" valign="top" width="100%">If the Frog agent in the Frogger game sees a Truck agent to its left (no matter how the truck looks like), it will collide with it and plays a sound, changes to look like the dead frog, waits half a second, erases itself, decrements the Lives counter and broadcasts to the frog_generator to create a new Frog at the start.  
+
| align="left" valign="top" width="80" | '''Definition:'''
[[Image:See a condition example.png|500px]]</td>
+
| align="left" valign="top" width="100%" | True if there is a certain number of agents adjacent to me. Only check the eight agents immediately adjacent to me.&nbsp;
</tr>
+
|-
 +
| align="left" valign="top" width="80" | '''Parameters:'''
 +
| align="left" valign="top" width="100%" |
 +
[[Comparator parameter|comparator]]:&nbsp;''mathematical operator'' <br>[[VAT Formula parameter|number]]:&nbsp;''how many''&nbsp;(may be a number or VAT formula)<br> [[Shape parameter|shape]]:&nbsp;''what shape''
 +
[[Layer parameter|layer]]: which layer to search for the target agent
  
</table>
+
layer: which layer to search for the target agent
 +
 
 +
|-
 +
| align="left" valign="top" width="80" | '''Example:'''
 +
| align="left" valign="top" width="100%" |
 +
'''nextTo (&gt;=, 2, ghost)''' means: are there 2 or more ghosts immediatly adjacent to me?
 +
 
 +
<br>  
 +
 
 +
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|Next to condition example.png]]
 +
 
 +
|}
  
 
[[Category:AgentCubes_Conditions]]
 
[[Category:AgentCubes_Conditions]]

Latest revision as of 01:29, 21 April 2012

Next to condition.png

Next to expanded.png

Definition: True if there is a certain number of agents adjacent to me. Only check the eight agents immediately adjacent to me. 
Parameters:

comparatormathematical operator
numberhow many (may be a number or VAT formula)
shapewhat shape layer: which layer to search for the target agent

layer: which layer to search for the target agent

Example:

nextTo (>=, 2, ghost) means: are there 2 or more ghosts immediatly adjacent to me?


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