I have a doubt/intrigued by a NetLogo situation. Also, I don't know if there is a solution and the exact reason for this to occur.
I made a small code to exemplify my question...
What happens is the following:
- When I click on the setup button and then on the go and let for example 20 ticks pass, I have the following movement of the turtles (see figure below)
- But, if you press the setup button, then a button created in the interface to show and disapear the turtles labels (turtle labels) and then press go and leave the 20 ticks, another movement of the turtles appears (see figure below)
I would like to know why this happens? Will it be by the use of one-of?
And if there is any solution, because I need to see the turtle label in the interface to follow the model and check its operation.
If anyone has any ideas on how to resolve this and why this happens, I would appreciate it.
Thanks in advance :)
globals [ edge-size ValidHabs PatchSet ]
patches-own [ scale-patch ]
to setup
ca
random-seed 1
set ValidHabs [ [1] [2] [3] ]
set edge-size 60
set-patch-size 20
let list1 ( list 4 8 )
set PatchSet patches with [
( pxcor mod ( 2 + 1 ) = 0 ) and ( pycor mod ( 2 + 1 ) = 0 ) ]
(
foreach ValidHabs [
this-profile ->
ask one-of PatchSet [ sprout 1 ]
]
)
ask patches [
set scale-patch random 10
set pcolor scale-color green scale-patch -8 12
]
reset-ticks
end
to go
do-something
tick
end
to do-something
move-turtles
end
to move-turtles
ask turtles [
rt random-normal 0 90
fd 3
set color black
pen-down
set pen-size 2
]
end
;Interface button code (turtle labels)
;ask turtles [
; ifelse label = "" [
; set label ( who )
; set label-color white
; ]
; [
; set label ""
; ]
;]



