Reputation: 13
I'm new to this Forum and I'm looking forward to hearing from you and, when possible, provide some of my own knowledge.
I'm trying to have turtles in my model decide randomly, but coherently on a group level.
In my model, each turtle has a native language. They are then split in several groups and I want each group to decide on a common language to use which should be the most recurring native language, in other words, the modal language of the group. This usually works smoothly, unless the group has more than one mode, in which case I initially used the "one-of" function, as follows:
To go
ask turtles [ define-majority-language ]
...
You define-majority-language
let my-mates turtles with [ my-group = [ my-group ] of myself ]
set my-group-majority-language one-of modes [ language-spoken ] of my-mates
end
However, I quickly realized that every turtle is making her random "one-of" choice individually, so some group members are going for one and other group members are going for the other, while I want all group members to choose randomly but coherently, i.e. they should all agree on the same language to use. I also tried to make an agentset
but there again, members act individually...
How can I do that?
Upvotes: 1
Views: 74
Reputation: 17678
I think what you want to do is have the first chooser impose that choice. So, once chosen, set the language for the other turtles in the my-mates
agentset as well. This also means that you only want to have a turtle choose a language if one hasn't already been chosen. Try this.
to go
...
define-majority-language
...
end
to define-majority-language
ask turtles
[ if my-group-majority-language = 0 ;; or whatever your initialisation is
[ let my-mates turtles with [ my-group = [ my-group ] of myself ]
set my-group-majority-language one-of modes [ language-spoken ] of my-mates
ask my-mates [ set my-group-majority-language my-group-majority-language ]
]
]
end
Upvotes: 1