Skip to main content

3.6) Tick and Ticks


In many NetLogo models, time passes in discrete steps, called "ticks". NetLogo includes a built-in tick counter so you can keep track of how many ticks have passed. The current value of the tick counter is shown above the view. (You can use the Settings button to hide the tick counter, or change the word "ticks" to something else.) In the Go procedure we have already seen two commands related to that: tick and ticks. How do these differ?

tick – increments time by one period (“tick” is a primitive that simply increments the value of tick counter)

ticks – measures the time lapsed since the start (“ticks” is a reporter that provides the current value of tick counter)

Below are a good and a bad example of the use of tick and ticks (think these through!).

Good Code:

to go
   tick
   if ticks > max-ticks [stop]
   ...
   ask turtles [set age ticks]
end

Bad Code:

to go
   ticks
   if (tick > 500 [stop]
   ask turtles [tick set age ticks]
end