a problem about iterating roles while keep the id_in_group fixed

66 views
Skip to first unread message

Min Fang

unread,
Jul 21, 2021, 11:41:29 AM7/21/21
to oTree help & discussion
Hi, Chris

Before I bring up my detailed questions, let me describe the background first.

There are 9 participants in a session and 3 roles in my project: a, b, and c.
I have set players_per_group = 3 and a_role = "a", b_role = "b", and c_role = "c" in calss Constants. In the first round, oTree assigns roles to 9 participants sequantially according to their in_in_group. In the next rounds, I want to keep the id_in_group fixed and let the role sequence iterates forward as the picture below.

image.png
I do not know how to realize this by oTree. Could you please give me a hint?
Thanks,
Milley

Chris @ oTree

unread,
Jul 21, 2021, 11:46:46 AM7/21/21
to oTree help & discussion
Roles are designed to be directly determined by id_in_group. They are basically friendly labels for id_in_group. Is there a reason you don't want to change id_in_group?

Min Fang

unread,
Jul 21, 2021, 12:41:59 PM7/21/21
to oTree help & discussion

Thanks for your reply!
The first reason is that I want to create a cyclical relationship among 3 players in the group. Let's say A stands for the leader of B and C just means the player is vacant in this round. In round 1, player1 is the leader of player2. In round 2, player2 becomes the leader of player3. In round 3, player3 becomes the leader of player1, thus forming a closed loop.
The second reason is that the payoff of the leader in the current round depends not only on her own payoff in this round but also her  subordinate's payoff in the NEXT ROUND when her subordinate turns into the leader of the vacant player. I need to make sure the pair of leader and subordinate evolves sequantially not randomly.
I hope my information might make sense.

Chris @ oTree

unread,
Jul 21, 2021, 1:03:44 PM7/21/21
to oTree help & discussion
You can still do all these things if you modify id_in_group. id_in_group is intended to change between rounds. However, player's id_in_subsession remains constant.

Min Fang

unread,
Jul 21, 2021, 9:46:13 PM7/21/21
to oTree help & discussion
Here is what I am trying. The codes did not work and I find out that I do not know how to use the 'get_player_by...' series codes. I am confused about whether I should put this function into class subsession or group. 
捕获.PNG
As for the id_in_subsession, please tell me how to use it too.
Maybe these problems are quite basic. If there are examples related to these codes, could you please send them to me?
Reply all
Reply to author
Forward
0 new messages