I have a question about building a code below. I want to create a code where the turtles are created and each turtle will have a ray of vision (each turtle will be able to see a certain number of patches). After that I want the turtles to ask which of these patches have pveg > 5 and walk over to them and collect the pveg. When you have no more pveg than fd 150
Can anyone help me progress in the code?
I'm not getting the command to:
They check which patches within their vision range have pveg> 5 and then move in sequence to these patches and consume the pveg
which code can be used for turtles to consume pveg (patch variable)
turtles-own
[
vision
vision-patches
]
patches-own [ pveg ]
to setup
ask turtles [
set vision random-in-range 1 2
;show vision
set vision-patches []
foreach ( range 1 ( vision + 1 ) ) [ n ->
set vision-patches sentence vision-patches ( list ( list 0 n ) ( list n 0 ) ( list 0 ( -
n ) ) ( list ( - n ) 0 ) )
]
move
]
end
to-report random-in-range [ low high ]
report low + random ( high - low + 1 )
end
to move
let move-vision patch-set patch-here (patches at-points vision-patches) with [not
any? turtles-here])
let possible-patches-pveg move-vision with-max [pveg]
if any? possible-patches-pveg [
;; if there are any such patches move around
fd 150
]
endEvery help is welcome! Thanks
--
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_YBeCB4vtFC2iKABiGMVGg2QuZe%2BHh8J0wq_B0JuYwTw%40mail.gmail.com.
—
Prof. Murat Yildizoglu
Advisor to the Minister of Education, Youth and Sports of Cambodia
Expertise FranceOn temporary leave from
University of Bordeaux
#80 Preah Norodom Boulevard
Phnom Penh
Royaume du Cambodge
Telegram: +855 95 732 088
http://yildizoglu.fr
Hi Rafaela,I put some comments in the code. I don’t understand the signification of vision-patches, but the error comes from the fact that you try co compare this list with a distance.
<Murat_modify_test.rar>
—
Prof. Murat Yildizoglu
Advisor to the Minister of Education, Youth and Sports of Cambodia
Expertise France
<Murat_modify_test2.rar>
Hi Rafaela,
<PastedGraphic-6.tiff>
On temporary leave from
University of Bordeaux
#80 Preah Norodom Boulevard
Phnom Penh
Royaume du Cambodge
Telegram: +855 95 732 088
http://yildizoglu.fr
<Murat_modify_test3.rar>