N
Glam Fame Journal

How does NetLogo work

Author

Victoria Simmons

Updated on April 24, 2026

NetLogo uses the ask command to give commands to turtles, patches, and links. All code to be run by turtles must be located in a turtle “context”. You can establish a turtle context in any of three ways: In a button, by choosing “Turtles” from the popup menu.

What does FD mean in NetLogo?

forward number. The turtle moves forward by number steps, one step at a time. (If number is negative, the turtle moves backward.) fd 10 is equivalent to repeat 10 [ jump 1 ] .

How do you make a turtle in NetLogo?

  1. You can use the create-<breed> format to create new turtles of a specific custom breed such as create-dogs 100 or create-buildings 5 [ set color gray ] .
  2. Only the observer can create new turtles. You cannot use this primitive within an ask primitive.

What does pen-down do in NetLogo?

pen-down pen-erase pen-upThe turtle changes modes between drawing lines, removing lines or neither. The lines will always be displayed on top of the patches and below the turtles.

What does expected command mean in NetLogo?

Expected Command This error occurs when you have one too many brackets.

How do you change the turtle color in NetLogo?

  1. Select the text to the right of “color” in the Turtle Monitor.
  2. Type in a new color such as green + 2.

Is NetLogo hard?

Downloading and installing NetLogo is not difficult and does not require much space on your hard disk. You can access NetLogo Web or download NetLogo Desktop through the buttons on the NetLogo homepage .

How do I get rid of NetLogo turtle?

ctrl shift lswitch to authoring modectrl ;comment/uncomment a line of code (when in NetLogo Code editor)

What is sprout in NetLogo?

sprout is a patch-only primitive that allows us to ask patches to create new turtles. It must be used within an ask patches […] context.

What is random float in NetLogo?

random-float is a mathematics primitive that reports a random floating point number anywhere between 0 and the given number. For instance, random-float 10 could report 6.9105, 7, 4.2, 0.451, 0.0000001, 9.99999, etc. random-float is very useful in modeling phenomena that require continuous numbers.

Article first time published on

What is a primitive in NetLogo?

Primitives are the building blocks in NetLogo programming. They are the simplest and smallest pieces of pre-defined NetLogo keywords that can be used to put together longer algorithms to construct complex agent-based models.

What are globals in NetLogo?

Global variables are “global” because they are accessible by all agents and can be used anywhere in a model. Most often, globals is used to define variables or constants that need to be used in many parts of the program.

What is the difference between Penup and pen Erase command?

penup or pu means pick pen up, so you can move turtle without leaving tracks. pendown or pd means pick pen down, so you can move the turtle and leave tracks.

What makes the turtle's pen act like an eraser?

Answer: PENERASE turns the turtle’s pen into an eraser. When the turtle moves, it appears to erase by drawing in the current background color.

What language does NetLogo use?

What programming language was NetLogo written in? NetLogo is written mostly in Scala, with some parts in Java. (Scala code compiles to Java byte code and is fully interoperable with Java and other JVM languages.)

What are NetLogo reporters?

A reporter is a predefined procedure that returns a value and, unlike a command, cannot be a stand-alone code element. NetLogo has some useful built-in reporters that cannot be changed directly such as ticks , pi , e , world-width , and world-height .

What is Repast Simphony?

Repast Simphony is a agent-based modeling toolkit and cross platform Java-based modeling system that runs under Microsoft Windows, Apple macOS, and Linux. Repast supports the development of extremely flexible models of interacting agents for use on workstations and computing clusters.

What is observer in NetLogo?

The observer oversees everything that’s going on and does whatever the turtles, patches and links can’t do for themselves. All four types of agents can run NetLogo commands. All four can also run “procedures”. A procedure combines a series of NetLogo commands into a single new command that you define.

How do I set NetLogo speed?

  1. Move the speed slider to the middle.
  2. Try moving the speed slider to the right.
  3. Now try checking and unchecking the “view updates” checkbox.

What does mod do in NetLogo?

mod is a mathematics primitive that completes the modulo operation, which takes two numbers, divides them, and returns the remainder.

What is NetLogo neighbors4?

neighbors4. Reports an agentset containing the four neighboring patches in cardinal directions (north, west, south, east). Read more. patch-ahead. Reports the single patch that is the given distance “ahead” of this turtle.

How does random work in Netlogo?

At every tick, the computer selects a random number between 1 and “sample-space” (a slider in the interface tab). For instance, if the slider reads 100, then the random number will be between 1 and 100, inclusive. This random number piggy-backs on a virtual dart.

What is a random float number?

The random. uniform() function returns a random floating-point number between a given range in Python. For example, It can generate a random float number between 10 to 100 Or from 50.50 to 75.5.