コード例 #1
0
    def after_all_players_arrive(self):
        if self.round_number != Constants.rt[self.group.id_in_subsession - 1]:
            group = self.group
            p1 = group.get_player_by_id(1)
            p2 = group.get_player_by_id(2)
            p1.payoff = get_payoff_p1(group.sent_amount,
                                      group.sent_back_amount)
            p2.payoff = get_payoff_p2(group.sent_amount,
                                      group.sent_back_amount)

            i = (2 * self.group.id_in_subsession) - 2
            j = self.round_number - 1
            matrix[i][j] = p1.payoff
            matrix[i + 1][j] = p2.payoff

        if self.round_number == Constants.rt[self.group.id_in_subsession - 1]:
            group = self.group
            p1 = group.get_player_by_id(1)
            p2 = group.get_player_by_id(2)
            p1.payoff = get_payoff_p1(group.sent_amount,
                                      group.sent_back_amount)
            p2.payoff = get_payoff_p2(group.sent_amount,
                                      group.sent_back_amount)

            i = (2 * self.group.id_in_subsession) - 2
            j = self.round_number - 1
            matrix[i][j] = p1.payoff
            matrix[i + 1][j] = p2.payoff
コード例 #2
0
    def after_all_players_arrive(self):
        if self.round_number == 1:
            print("group: ", self.group.id_in_subsession)
            print("number of rounds: ",Constants.rt[self.group.id_in_subsession-1])


        if self.round_number != Constants.rt[self.group.id_in_subsession-1]:
            group = self.group
            p1 = group.get_player_by_id(1)
            p2 = group.get_player_by_id(2)
            i = (2 * self.group.id_in_subsession) - 2
            j = self.round_number - 1
            p1.payoff = get_payoff_p1(group.sent_amount, group.sent_back_amount,i,j)
            p2.payoff = get_payoff_p2(group.sent_amount, group.sent_back_amount,i,j)

            matrix[i][j] = p1.payoff
            matrix_beliefs[i][j] = get_belief_payoff_p1(group.sent_belief, group.sent_back_amount)
            matrix_toString [i][j] = group.sent_amount
            if group.sent_belief >= 50:
                matrix_beliefs_toString [i][j] = str(group.sent_belief) + "%"
            else:
                matrix_beliefs_toString [i][j] = str(group.sent_belief) + "%"

            matrix[i + 1][j] = p2.payoff
            matrix_beliefs[i + 1][j] = get_belief_payoff_p2(group.sent_back_belief, group.sent_amount)
            matrix_toString[i + 1][j] = group.sent_back_amount
            if group.sent_back_belief >= 50:
                matrix_beliefs_toString[i + 1][j] = str(group.sent_back_belief)  + "%"
            else:
                matrix_beliefs_toString[i + 1][j] = str(group.sent_back_belief) + "%"

        if self.round_number == Constants.rt[self.group.id_in_subsession-1]:
            group = self.group
            p1 = group.get_player_by_id(1)
            p2 = group.get_player_by_id(2)
            i = (2 * self.group.id_in_subsession) - 2
            j = self.round_number-1
            p1.payoff = get_payoff_p1(group.sent_amount, group.sent_back_amount,i,j)
            p2.payoff = get_payoff_p2(group.sent_amount, group.sent_back_amount,i,j)


            matrix[i][j] = p1.payoff
            matrix_beliefs[i][j] = get_belief_payoff_p1(group.sent_belief, group.sent_back_amount)
            matrix_toString [i][j] = group.sent_amount
            if group.sent_belief >= 50:
                matrix_beliefs_toString [i][j] = str(group.sent_belief) + "%"
            else:
                matrix_beliefs_toString [i][j] = str(group.sent_belief) + "%"

            matrix[i + 1][j] = p2.payoff
            matrix_beliefs[i + 1][j] = get_belief_payoff_p2(group.sent_back_belief, group.sent_amount)
            matrix_toString[i + 1][j] = group.sent_back_amount
            if group.sent_back_belief >= 50:
                matrix_beliefs_toString[i + 1][j] = str(group.sent_back_belief) + "%"
            else:
                matrix_beliefs_toString[i + 1][j] = str(group.sent_back_belief) + "%"

            matrix_finished.append(1)
            print(matrix_finished)
コード例 #3
0
    def after_all_players_arrive(self):
        if self.round_number != 4:
            group = self.group
            p1 = group.get_player_by_id(1)
            p2 = group.get_player_by_id(2)
            p1.payoff = get_payoff_p1(group.sent_amount,
                                      group.sent_back_amount)
            p2.payoff = get_payoff_p2(group.sent_amount,
                                      group.sent_back_amount)

            i = (2 * self.group.id_in_subsession) - 2
            j = self.round_number - 1

            matrix[i][j] = p1.payoff
            matrix_beliefs[i][j] = get_belief_payoff_p1(
                group.sent_belief, group.sent_back_amount)
            matrix_toString[i][j] = group.sent_amount
            if group.sent_belief >= 50:
                matrix_beliefs_toString[i][j] = "Assertive: " + str(
                    group.sent_belief)
            else:
                matrix_beliefs_toString[i][j] = "Exert restraint: " + str(
                    group.sent_belief)

            matrix[i + 1][j] = p2.payoff
            matrix_beliefs[i + 1][j] = get_belief_payoff_p2(
                group.sent_back_belief, group.sent_amount)
            matrix_toString[i + 1][j] = group.sent_back_amount
            if group.sent_back_belief >= 50:
                matrix_beliefs_toString[i + 1][j] = "Challenge: " + str(
                    group.sent_back_belief)
            else:
                matrix_beliefs_toString[i + 1][j] = "Do not challenge: " + str(
                    group.sent_back_belief)

        if self.round_number == 4:
            group = self.group
            p1 = group.get_player_by_id(1)
            p2 = group.get_player_by_id(2)
            p1.payoff = get_payoff_p1(group.sent_amount,
                                      group.sent_back_amount)
            p2.payoff = get_payoff_p2(group.sent_amount,
                                      group.sent_back_amount)

            i = (2 * self.group.id_in_subsession) - 2
            j = self.round_number - 1

            matrix[i][j] = p1.payoff
            matrix_beliefs[i][j] = get_belief_payoff_p1(
                group.sent_belief, group.sent_back_amount)
            matrix_toString[i][j] = group.sent_amount
            if group.sent_belief >= 50:
                matrix_beliefs_toString[i][j] = "Assertive: " + str(
                    group.sent_belief)
            else:
                matrix_beliefs_toString[i][j] = "Exert restraint: " + str(
                    group.sent_belief)

            matrix[i + 1][j] = p2.payoff
            matrix_beliefs[i + 1][j] = get_belief_payoff_p2(
                group.sent_back_belief, group.sent_amount)
            matrix_toString[i + 1][j] = group.sent_back_amount
            if group.sent_back_belief >= 50:
                matrix_beliefs_toString[i + 1][j] = "Challenge: " + str(
                    group.sent_back_belief)
            else:
                matrix_beliefs_toString[i + 1][j] = "Do not challenge: " + str(
                    group.sent_back_belief)