Reputation: 3828
I am working on a model which consists of a bunch of nodes which are connected by links. There are two type of agents initially, lets say yellow-bees and collectors. My collectors find a node on which bees are located, travel to it and collect the bees.( The way the model works is when the collector reach the node on which the bee is situated on, the bee is killed and collectors-own variable called, bees-collected will be updated by 1). Next the collector will travel to some node, lets sat node with bee-hive. At this point I want to create a new breed, lets say new variety of bee, i.e red-bees. The problem arises because only the observer can create a new breed and not the collector. Hatching would also not work because it will create more collectors and not a new red bee. Any idea how to solve this ?
breed [yellow-bees yellow-bee]
breed [collectors collector]
breed [red-bees red-bee]
breed [nodes node]
breed [hives hive]
collectors-own [bees-collected current-node]
nodes [hive-present]
to go
...
...
ask collectors[
if current-node = nodes with [hive-present = True][
create-red-bees bees-collected
]
]
Upvotes: 2
Views: 1991
Reputation: 14972
Hatching will work if you use the hatch-<breeds>
version of the command which, as mentioned in the NetLogo dictionary entry, will create new turtles of the given breed.
Here is an example:
breed [collectors collector]
breed [red-bees red-bee]
to setup
clear-all
create-collectors 10
ask collectors [
hatch-red-bees 1
]
print count red-bees
end
Upvotes: 4