Nearest Within Steps: Difference between revisions

From StarLogo Nova Wiki
(Marked this version for translation)
(duplicate file already uploaded)
 
(3 intermediate revisions by the same user not shown)
Line 11: Line 11:


<!--T:2-->
<!--T:2-->
== Usage==
==Usage==
<code>nearest [▼] within [_] steps</code> is used to refer to the nearest [[agent]] of a selected breed that exists within a given [[step]] limit in [[Spaceland]].
<code>nearest [▼] within [_] steps</code> is used to refer to the nearest [[agent]] of a selected breed that exists within a given [[step]] limit in [[Spaceland]].


Line 17: Line 17:


<!--T:4-->
<!--T:4-->
<section begin=image/>[[File:Nearest Within Steps.png|right|alt=The Create Each Do Block|thumb]]<section end=image/>
[[File:Nearest Within Steps.png|right|alt=The Create Each Do Block|thumb]]
<!-- <code>nearest [Dropdown: Type of Agent](s) within [Textbox: Number] steps</code> -->  
<!-- <code>nearest [Dropdown: Type of Agent](s) within [Textbox: Number] steps</code> -->  
Inputs in this block:
Inputs in this block:
#a breed from the dropdown menu
#a breed from the dropdown menu
#a number
#a number
==Example== <!--T:10-->
<!--T:11-->
[[File:nearest_within_steps_example.gif|alt=Nearest Within Steps example gif|thumb]]
[[File:face_towards_example.png|alt=Nearest Within Steps example code|thumb]]
<!--T:12-->
This is a model of a grazing herd of elephants.  Because the elephants want to acquire the most food possible, they walk toward the grass that is closest to them within their sensing radius (30 steps).


==Common Uses== <!--T:5-->
==Common Uses== <!--T:5-->

Latest revision as of 15:33, 16 August 2023

Other languages:
Nearest within steps

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

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

Usage

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

Syntax

The Create Each Do Block

Inputs in this block:

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

Example

Nearest Within Steps example gif
Nearest Within Steps example code

This is a model of a grazing herd of elephants. Because the elephants want to acquire the most food possible, they walk toward the grass that is closest to them within their sensing radius (30 steps).

Common Uses

Nuances

Related Blocks