hyperlink - How to add just one single link between two different breeds in Netlogo -



hyperlink - How to add just one single link between two different breeds in Netlogo -

i'd love help creating links in netlogo.

essentially want add together 1 single link between 2 different breeds in netlogo, defined length 'particle-length'. link needs joined other breed next it. @ moment code creates volume exclusive set of turtles, 3 breeds. 1 randomly scattered, , other 2 within box. think initial arrangement of 2 different breeds within box needs fixing every violet next every green. want 50 greens(big) , 50 purples(small) connected 1 link (green purple) link length of particle-length 1.

note water-number, big-number , small-number defined on slider value 50.

netlogo code:

breed [bigs big] breed [smalls small] breed [ waters water ] setup clear-all set particle-length 1.0 set-default-shape turtles "square" ;;to set bigs , smalls within central box inquire patches [ abs (min-pxcor - pxcor) > 22 , abs (min-pxcor - pxcor) < 23 + floor (sqrt ( big-number + small-number )) , abs (max-pycor - pycor) > 22 , abs (max-pycor - pycor) < 23 + floor (sqrt (big-number + small-number))] [sprout-bigs 1 [ set color greenish ] ] ;;now create half of bigs smalls inquire n-of big-number bigs [ set breed smalls] inquire smalls [set color violet] ;;randomly makes volume exclusive waters there no bigs or smalls inquire n-of water-number patches [ not any? turtles-here] [sprout-waters 1 [ set color bluish ]] inquire bigs [any? smalls-on neighbors4] [create-link-with one-of smalls-on neighbors4] reset-ticks end

the code throwing error

ask n-of ( big-number / 2 ) bigs [create-link-with one-of smalls-on neighbors4]

the simple reason @ to the lowest degree 1 of bigs beingness asked there no little on neighbors4`

changing

ask n-of ( big-number / 2 ) bigs [ if any? smalls-on neighbors4 [create-link-with one-of smalls-on neighbors4] ]

will prevent error might not behavior want. alternatively

ask n-of ( big-number / 2 ) bigs with[any? small-on neighbors4][create-link-with one-of smalls-on neighbors4]

hyperlink netlogo

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -