Loop through agents Netlogo
Date : March 29 2020, 07:55 AM
I hope this helps . You need to filter the breed2 turtles to remove those that already have a link before selecting turtles to create links with. You probably want something like: breed [breeds1 breed1]
breed [breeds2 breed2]
ask breeds1
[ create-link-with one-of (breeds2 with [not any? link-neighbors])
]
|
Netlogo Agents error
Date : March 29 2020, 07:55 AM
|
NetLogo: Using agents-own
Date : March 29 2020, 07:55 AM
|
you cant use tick in a turtle context because tick is observer only!! NETLOGO
Date : March 29 2020, 07:55 AM
wish of those help if energy < 20000 [ask adults [go-home den]] will be a problem in go if energy is (as it appears) a turtle variable. This will make the context of the procedure a turtle context, not an observer context. Edit: ask adults [if (energy < 20000) [go-home den]]
|
Find the difference between two variables of the agents of two different breeds - Netlogo
Date : March 29 2020, 07:55 AM
hop of those help? This is untested, but I hope it's close enough to get you there if it's not correct. First, you have some confusion with your breeds and turtles-own sex indicator. It would be much easier to have one or the other. Scrap your turtles-own statement entirely and simply test the breed because then you can't introduce errors where (for example) you have have the flag (girl? or boy?) inconsistent with the breed, or both set to TRUE or whatever. The way you have it set up, it is possible to have a turtle of breed boy but accidentally set its variable boy? to FALSE. There is no need for these variables at all, breed is an automatic variable (like who number or size that is created with the turtle) and you can test on the breed directly. boys-own [age-diff]
ask boys
[ let my-girls link-neighbors with [breed = girls]
if any? my-girls
[ set age-diff map [ x -> abs (x - age) [age] of my-girls ] ]
]
|