I want to run a set of scenarios in netlogo using behavior space where n number of competing turtles use different decision rules. What i mean by that is lets say i want to measure a metric in a coin-toss scenario where each player is programmed to call heads or tails at every tick i.e. in a 2 turtle situation player A always call heads and player B always calls tails.
When the number of turtles is more than 3 there will cases where ABC or ACB or BCD will call heads while the other calls tails. In essence HHTH is the same as HHHT.
So what i want to do in short is to filter only for the unique occurences, without considering the position of H or T in the sample space i.e. I want only those cases where there is only 1H and 3T, 2H & 2T, 3H & 1T.
Thanks in advance for the help. Regards.
Your question as asked does not seem to involve behavior space. To count the heads in a list use the
table
extension. (The example you give is binary and has fixed length sequences, so the number of heads determines the number of tails, so you only need to count one of them.)For example, we can generate some random sequences of length 4 (from your example) and filter for those with length 2 (or anything else).
If you are storing the sequences as strings, you can install the string extension and
explode
the strings before using the above code, or you can follow NetLogo read in file as list of characters to convert strings to character lists. E.g.,