Nearest Within Steps With =/en: Difference between revisions

From StarLogo Nova Wiki
(Updating to match new version of source page)
(Updating to match new version of source page)
 
Line 17: Line 17:
#a breed from the first dropdown menu
#a breed from the first dropdown menu
#a number
#a number
==Example==
[[File:nearest_within_steps_with_example.gif|alt=Nearest Within Steps With = example gif|thumb]]
[[File:nearest_within_steps_with_example.png|alt=Nearest Within Steps With = example code|thumb]]
This is a model of a grazing herd of hungry elephants.  In this model, there are two species of grass (blue and red).  The elephants prefer blue glass but do not mind red grass.  Because the elephants want to eat as much bue grass as possible, they walk toward the blue grass that is closest to them within their sensing radius (while eating red grass if they happen across it on the way).  Toward the end of the simulation, you can observe that there is plenty of leftover red grass.


==Common Uses==
==Common Uses==

Latest revision as of 05:52, 12 August 2023

Other languages:
Nearest within steps with =

Returns the closest agent of a selected breed in a given radius with a specific trait.

nearest [▼] within [_] steps with [▼] = [_] is a code block part of the Detection drawer.

Usage

nearest [▼] within [_] steps with [▼] = [_] is used to refer to the nearest agent of a selected breed AND trait that exists within a given step limit in Spaceland.

Syntax

Nearest Within Steps With =

Inputs:

  1. a breed from the first dropdown menu
  2. a number

Example

Nearest Within Steps With = example gif
Nearest Within Steps With = example code

This is a model of a grazing herd of hungry elephants. In this model, there are two species of grass (blue and red). The elephants prefer blue glass but do not mind red grass. Because the elephants want to eat as much bue grass as possible, they walk toward the blue grass that is closest to them within their sensing radius (while eating red grass if they happen across it on the way). Toward the end of the simulation, you can observe that there is plenty of leftover red grass.

Common Uses

Nuances

Related Blocks