weighted_average(neighbor_data)
Description
Calculates the average of the block values from surrounding neighbors. With closer neighbors being weighted heavier than neighbors far away.
Parameters
neighbor_data An immutable global object containing the inputs from surrounding neighbors.
Compatibility
All Blocks
Return
The weighted average computed from the input of neighbors.
Example
void setup()
{
}
void loop()
{
think();
}
void think()
{
block_value = weighted_average(neighbor_data);
}