oTree Forum >

Setting players_per_group in session configs?

#1 by m_hr3


Is there any way to set the number of players_per_group in session configs?

I have multiple apps in a row and all of them need to have the same number of players_per_group. It's tricky to set this quickly if it's not in session configs but instead in Constants.

Is there any way to be able to set group size elsewhere than Constants?


#2 by Chris_oTree

You can set groups in creating_session:

def creating_session(subsession: Subsession):
    session = subsession.session
    players = subsession.get_players()
    ppg = session.config['players_per_group']
    matrix = []
    start = 0
    for i in range(0, len(players), ppg):
        start += ppg

Or, if you're using group_by_arrival_time, you can define your group_by_arrival_time_method to create a group of any size.

Write a reply

Set forum username