Difference between revisions of "Next-to Condition"

From AgentCubes
Jump to navigation Jump to search
imported>Andri
imported>Andri
Line 1: Line 1:
[[image:See a condition.png|150px]]
+
[[image:Next to condition.png|150px]]
  
[[image:See a condition additional params.png|150px]]
 
 
<table cellpadding="10" cellspacing="0" border="0" width="100%">
 
<table cellpadding="10" cellspacing="0" border="0" width="100%">
 
<tr>
 
<tr>
 
<td align="left" valign="top" width="80"><b>Definition:</b></td>
 
<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>
+
<td align="left" valign="top" width="100%">The <strong>Next-to</strong> condition checks to see how many of the adjacent neighbors have a certain [[Shape parameter|shape]]. If the agent is next to the right number of the specified shapes, the condition is true. Otherwise, the condition is false.</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
 
<td align="left" valign="top" width="80"><b>Parameters:</b></td>
 
<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>
+
<td align="left" valign="top" width="100%">[[Comparator parameter|comparator]], [[Formula parameter|formula]], [[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-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>
  
 
<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%">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.  
+
<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.  
[[Image:See a condition example.png|500px]]</td>
+
[[Image:Next to condition example.png|500px]]</td>
 
</tr>
 
</tr>
  

Revision as of 17:42, 17 June 2011

Next to condition.png

Definition: The Next-to condition checks to see how many of the adjacent neighbors 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 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. Next to condition example.png