netlogo turtle search function getting stuck in loop Netlogo
Date : March 29 2020, 07:55 AM
To fix the issue you can do random 20 might return 0 or 1, and then the first thing you do to move-distance inside the loop is subtract 1 from it, so the move-distance = 1 check will fail because it's already below 1. Try replacing move-distance = 1 with move-distance <= 1, and/or replace random 20 with 2 + random 18.
|
Netlogo: compare a variable of a turtle in two different moments in netlogo
Date : March 29 2020, 07:55 AM
Any of those help You need to store the lagged value (e.g., in a turtle attribute). For example, turtles-own [x xlag]
to setup
ca
crt 1 [set x random-float 1.0]
end
to go
ask turtles [set xlag x]
ask turtles [set x random-float 1.0]
ask turtle 0 [show x - xlag]
end
|
Netlogo: Can Netlogo set up an infinite number of turtles for only one specific patch?
Date : March 29 2020, 07:55 AM
I hope this helps . As per Bryan's answer, there is no theoretical restriction on the number of turtles in a single patch, although your computer will have a limit- the more turtles in your model (on any patch) the more memory your model will use. So the short answer is, as far as I know, there is no way to just say to Netlogo, "Spawn infinite turtles on this patch." If, however, by infinite you really just want enough turtles that you won't run out of them for specific interactions, you could probably get by either by just spawning a large number on that patch or by just sprouting more as needed (my preference). to setup
ca
reset-ticks
ask patch 0 0 [
sprout 10000
]
ask patch 0 0 [
print count turtles-here
]
end
to setup
ca
reset-ticks
infinite-sprout
source-sprout
end
to go
ask turtles with [ color = red ] [
fd 0.5
if any? ( turtles-on patch-ahead 1 ) with [ color = blue ] [
create-link-with one-of turtles-on patch-ahead 1 [
tie
]
set color green
]
]
ask turtles with [color = green] [
move-to patch-right-and-ahead 90 1
if pycor = max-pycor [
ask link-neighbors [
die
]
die
]
]
infinite-sprout
source-sprout
tick
end
to source-sprout
ask patch max-pxcor 0 [
if not any? turtles-here and random 3 = 1 [
sprout 1 [
set shape "arrow"
set color red
set heading 270
]
]
]
end
to infinite-sprout
ask patch 0 0 [
if count turtles-here < 1000 [
sprout ( 1000 - count turtles-here) [
set shape "circle"
set color blue
]
]
]
end
|
How do I translate my code from Netlogo to Netlogo Web? ('TO or TO-REPORT expected' error)
Date : March 29 2020, 07:55 AM
|
Is NetLogo too slow for big simulations? How can I speed up a NetLogo model?
Date : March 29 2020, 07:55 AM
|