average-of-patches-with
[condition] [list of commands]
Parameters:
[condition] |
List of patch commands |
An expression that returns a true or false value |
[list of commands] |
List of patch commands |
A list of commands for the patches to run which returns a number |
Description:
Returns the numerical average of the [list of commands] when evaluated across all the patches that satisfy the condition (must return a boolean of true or false) specified by the [condition].
Examples:
average-of-patches-with [color = red] [food]
returns the average food of all the red patches
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
Related Commands:
average-of-breed-with
median-of-patches-with
min-of-patches-with
mode-of-patches-with
sum-of-patches-with
variance-of-patches-with