#1 by RudyDW
Dear all, Is it possible to define the group size (C.PLAYERS_PER_GROUP) dynamically? What I have in mind is checking the number of active players in a first app and, based on this number, I could define PLAYERS_PER_GROUP in a second app. Could you tell me whether this is possible? Thanks. Rudy
#2
by
BonnEconLab
Yes, that it possible. You do not have to use the PLAYERS_PER_GROUP constant for this purpose at all. (You can set it to None.) See https://otree.readthedocs.io/en/latest/multiplayer/groups.html#set-group-matrix: “set_group_matrix() lets you modify the group structure in any way you want.” That is, for instance, if you have 27 participants, you can use set_group_matrix() to create six 4-player groups and one 3-player group. (In addition, if you do not want that last, incomplete, group to participate in any decision-making, you could direct it to a page or an app that treats them as drop-outs.) As a matter of fact, according to https://otree.readthedocs.io/en/latest/multiplayer/groups.html#shuffling-during-the-session, you don’t need two apps for this purpose. You can also use a WaitPage for group formation.
#3 by RudyDW
Thank you very much. I did not know that it was allowed to use set_group_matrix() if PLAYERS_PER_GROUP was set to None. Rudy