oTree Forum >

Stranger matching in pairs

#1 by txb000

Hi, I am trying to do a random re-matching in a two-player incomplete information contest game with 6 participants i.e., suppose for round 1, participant 1 is paired with participant 3 in round 1, in round 2, participant 1 maybe paired with participant 6, in round 3 participant 1 maybe paired with participant 4, and so on. That happens for all participants. Its random re-matching and pairs are formed after each round. Please see the code below and guide me. I am always getting the same pair in every round. I have uploaded the __init__.py and the settings.py file.

#2 by Daniel_Frey

Hi there,

I see your problem: Creating session is directly run after the session is created, and once for every round.

In your example, your group-structure is shuffled five times and the last result will be used for the whole experiment. You need to shuffle them again in your WaitPage.

See here for more info: https://otree.readthedocs.io/en/latest/multiplayer/groups.html#shuffling-during-the-session

By the way: you set player.cost in vars_for_template on your InvestmentDecision-Page. Be careful: When a player reloads the page, vars_for_template gets executed again and the value can change!

Write a reply

Set forum username