Is it possible to use the sprout comanod creating new turtles by order?

90 views
Skip to first unread message

Rafaela Lorena

unread,
Aug 24, 2021, 2:47:56 PM8/24/21
to netlogo-users
Hello everyone,

I have a question and I would like to know if someone from the group can help me?

I have a closed world of 500x500 patches and I use the sprout command to "spawn" 1 turtle in each patch of that world. But turtles are randomly born in the world. Would it be possible to be born in an orderly way originating in the corner (location of origin) bottom left? Or is there another way I can do this?

I thank the attention

Rafaela Lorena

unread,
Aug 24, 2021, 4:37:28 PM8/24/21
to Martín Otálora Low, netlogo-users
Hi Martín Otálara Low and all,

Thank you very much for your answer, Martín. I read the "hatch" command and I think it might do. But how can I ask for a closed world with the localof origin in the corner bottom left, to be born in patch (0 0) the turtle 0, in the patch (1 0) the turtle 1, in the patch (20) the turtle 2 and so on successively until the end of the world? I thought about the following code below, but the hatch command can't be used with ask patches and I used ask turtles and it didn't work.

Does anyone have any idea how I can do this?

to setup
  clear-all
end

to test
let coordX min-pxcor
let coordY min-pycor
while [coordY <= max-pycor] [
while [coordX <= max-pxcor][
      ask patch coordX coordY [ hatch 1 ]
set coordX coordX + 1
]
set coordY coordY + 1
set coordX min-pxcor
]
end


Thanks in advance


Em ter., 24 de ago. de 2021 às 15:56, Martín Otálora Low <martin....@gmail.com> escreveu:
I think that hatch would be useful to you

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/CAHs8kB_gZHoQXPPDkxOZj0a0i40QQ5ubO%3DVJ%2B0ZnMN11gDf9zw%40mail.gmail.com.

Charles Staelin

unread,
Aug 24, 2021, 4:46:37 PM8/24/21
to netlogo-users
Rafael,

turtles "hatch"; patches "sprout".  If you replace "hatch 1" with "sprout 1", you should be fine.

Charles

Rafaela Lorena

unread,
Aug 24, 2021, 4:58:09 PM8/24/21
to Charles Staelin, netlogo-users
Hello Charles,

Thank you so much. I had been trying using "sprout" too and it hadn't worked. But there were two "hatch" that I had not seen. Then I redid the code with what I sent here and replaced it with "sprout" and it worked. THANK YOU VERY MUCH

Cheers

Reply all
Reply to author
Forward
0 new messages