Payment from the random round

閲覧: 340 回
最初の未読メッセージにスキップ

Hyoeun Park

未読、
2021/04/16 14:50:132021/04/16
To: oTree help & discussion
Hi All,

I want to pick one random round for the payment.
I have three rounds and three tasks, and each subject conduct the only one task in each round. (I did it because I want to randomize the sequence)

I saved the payoff from the each round using "plater.profit_this_round"
I made the following code:

class Round1(Page):
form_model = "player"
form_fields = ["w_1"]

@staticmethod
def is_displayed(player):
return player.round_number == player.participant.task_rounds['R1']

def before_next_page(player, timeout_happened):
player.profit_r1 = payoff_1(player.w_1, Constants.vA_1, Constants.vB_1, Constants.tA_1, Constants.tB_1)
player.profit_this_round = player.profit_r1


class Round2(Page):
form_model = "player"
form_fields = ["w_2"]

@staticmethod
def is_displayed(player):
return player.round_number == player.participant.task_rounds['R2']

def before_next_page(player, timeout_happened):
player.profit_r2 = payoff_1(player.w_2, Constants.vA_2, Constants.vB_2, Constants.tA_2, Constants.tB_2)
player.profit_this_round = player.profit_r2


class Round3(Page):
form_model = "player"
form_fields = ["w_3"]

@staticmethod
def is_displayed(player):
return player.round_number == player.participant.task_rounds['R3']

def before_next_page(player, timeout_happened):
player.profit_r3 = payoff_1(player.w_3, Constants.vA_3, Constants.vB_3, Constants.tA_3, Constants.tB_3)
player.profit_this_round = player.profit_r3


So, I want to pick one of "player.profit_this_round" from all three rounds, and I also want to save the decision in the chosen round.
That means, if the one with form_fields = ["w_2'] is chosen, I want to save w_2 as well.

To the best of my knowledge, I need "waitpage" to pick one random round, but I have no idea how to do it concretely. 

I tried
payment_round = random.randine(1,3)
player.payoff = player.profit_this_round.payment_round but it definitely did not work.

I would appreciate any help from you!

Best,
Hyoeun
全員に返信
投稿者に返信
転送
新着メール 0 件