oTree Forum >

Random re-matching in each round not working

#1 by Nishtha

Hi

I am using the standard code for random rematching of participants into different groups in each round while keeping the id in group constant using the following command.

class Subsession(BaseSubsession):
    def creating_session(subsession):
        subsession.group_randomly(fixed_id_in_group=True)  # Group players randomly while keeping ID in group fixed

However, it is just not working. The group numbers remain constant for each participant in every round. This same code used to work in the past but not anymore. What am I doing wrong?

I have also attached my __init__.py file.

Thanks a lot.

#2 by Chris_oTree

there should not be any functions indented under your Subsession/Group/Player. They should be top level functions.

#3 by Simon

Hi,

you need to define the creating_session() outside of the Subsession() class. So you code should look like this.

class Subsession(BaseSubsession):
    pass
    
def creating_session(subsession):
    subsession.group_randomly(fixed_id_in_group=True)  # Group players randomly while keeping ID in group fixed
    
~Simon

#4 by Nishtha

Thanks a lot.

Write a reply

Set forum username