netlogo - Using a breed-own variable in another breed? -
hello trying write code in netlogo in can use own variable named energy of breed named green-cars in breed named red-cars. problem depending of value of variable want create new red-cars command hatch-red car used hatch new turtle of breed can used asking same breed it. using value of energy green-cars variable want use value in yellow-cars context, can do? think in doing in report procedure i'm not familiar kind of procedures. suggestions?
this code:
breed [green-cars green-car] breed [red-cars red-car] green-cars-own [energy] go ask green-cars [manipulate-cars] end manipulate-cars if [energy] of one-of green-cars > 0 [ let induction sum [energy] of green-cars in-radius 1 let mean (induction / 3) let se ((- kse * (mean - count red-cars))) if se > 0 [ ask one-of red-cars[ hatch-red-cars se [ set shape "cars" set color red set size 1 set xcor (38 + random-float -76 ) set ycor (38 + random-float -49)] ] ] ] end
i having trouble understanding question, think asking 1 breed hatch different breed. if question, can use hatch-<breeds>
command, ask one-of green-cars [hatch-red-cars 1 [] ]
fine
Comments
Post a Comment