from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import copy import itertools author = 'Junya Zhou' doc = """ Reporting all twenty attributes """ class Constants(BaseConstants): name_in_url = 'Complex_Twenty' players_per_group = 2 num_rounds = 20 time = 15 # if this number changes, the following dim_ report should also change initial_prior = 1/3 sender_payoffs = [c(15), c(12), c(3)] receiver_payoffs = [c(15), c(12), c(8), c(3)] class Subsession(BaseSubsession): #The code is working, for each round, the profiles are randomly drawn. def creating_session(self): self.group_randomly(fixed_id_in_group = True) Up_first = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 12, 12, 10, 11, 11] Middle_first = [3, 3, 1, 1, 2, 5, 6, 6, 4, 4, 8, 8, 9, 9, 7, 10, 11, 12, 12, 10] Down_first = [2, 1, 3, 2, 1, 6, 5, 4, 6, 5, 9, 9, 8, 7, 9, 11, 10, 11, 10, 12] Up_second = [5, 6, 6, 5, 5, 8, 7, 9, 9, 8, 11, 10, 12, 12, 11, 3, 3, 2, 2, 1] Middle_second = [4, 5, 4, 4, 6, 9, 8, 8, 7, 7, 12, 12, 11, 10, 10, 2, 1, 1, 3, 3] Down_second = [6, 4, 5, 6, 4, 7, 9, 7, 8, 9, 10, 11, 10, 11, 12, 1, 2, 3, 1, 2] Up_third = [12, 10, 12, 11, 11, 2, 2, 3, 3, 1, 6, 5, 5, 6, 6, 9, 7, 8, 8, 9] Middle_third = [10, 12, 10, 10, 12, 1, 3, 2, 1, 3, 4, 4, 6, 5, 4, 7, 8, 7, 9, 8] Down_third = [11, 11, 11, 12, 10, 3, 1, 1, 2, 2, 5, 6, 4, 4, 5, 8, 9, 9, 7, 7] # Middle, Down, Up Up_fourth = [3, 3, 1, 1, 2, 5, 6, 6, 4, 4, 8, 8, 9, 9, 7, 10, 11, 12, 12, 10] Middle_fourth = [2, 1, 3, 2, 1, 6, 5, 4, 6, 5, 9, 9, 8, 7, 9, 11, 10, 11, 10, 12] Down_fourth = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 12, 12, 10, 11, 11] Up_fifth = [4, 5, 4, 4, 6, 9, 8, 8, 7, 7, 12, 12, 11, 10, 10, 2, 1, 1, 3, 3] Middle_fifth = [6, 4, 5, 6, 4, 7, 9, 7, 8, 9, 10, 11, 10, 11, 12, 1, 2, 3, 1, 2] Down_fifth = [5, 6, 6, 5, 5, 8, 7, 9, 9, 8, 11, 10, 12, 12, 11, 3, 3, 2, 2, 1] Up_sixth = [10, 12, 10, 10, 12, 1, 3, 2, 1, 3, 4, 4, 6, 5, 4, 7, 8, 7, 9, 8] Middle_sixth = [11, 11, 11, 12, 10, 3, 1, 1, 2, 2, 5, 6, 4, 4, 5, 8, 9, 9, 7, 7] Down_sixth = [12, 10, 12, 11, 11, 2, 2, 3, 3, 1, 6, 5, 5, 6, 6, 9, 7, 8, 8, 9] # Down Up Middle Up_seventh = [2, 1, 3, 2, 1, 6, 5, 4, 6, 5, 9, 9, 8, 7, 9, 11, 10, 11, 10, 12] Middle_seventh = [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 12, 12, 10, 11, 11] Down_seventh = [3, 3, 1, 1, 2, 5, 6, 6, 4, 4, 8, 8, 9, 9, 7, 10, 11, 12, 12, 10] Up_eighth = [6, 4, 5, 6, 4, 7, 9, 7, 8, 9, 10, 11, 10, 11, 12, 1, 2, 3, 1, 2] Middle_eighth = [5, 6, 6, 5, 5, 8, 7, 9, 9, 8, 11, 10, 12, 12, 11, 3, 3, 2, 2, 1] Down_eighth = [4, 5, 4, 4, 6, 9, 8, 8, 7, 7, 12, 12, 11, 10, 10, 2, 1, 1, 3, 3] Up_ninth = [11, 11, 11, 12, 10, 3, 1, 1, 2, 2, 5, 6, 4, 4, 5, 8, 9, 9, 7, 7] Middle_ninth = [12, 10, 12, 11, 11, 2, 2, 3, 3, 1, 6, 5, 5, 6, 6, 9, 7, 8, 8, 9] Down_ninth = [10, 12, 10, 10, 12, 1, 3, 2, 1, 3, 4, 4, 6, 5, 4, 7, 8, 7, 9, 8] # set 4 5, 6 Up_tenth = [7, 7, 7, 8, 8, 12, 12, 10, 11, 11, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6] Middle_tenth = [8, 8, 9, 9, 7, 10, 11, 12, 12, 10, 3, 3, 1, 1, 2, 5, 6, 6, 4, 4] Down_tenth = [9, 9, 8, 7, 9, 11, 10, 11, 10, 12, 2, 1, 3, 2, 1, 6, 5, 4, 6, 5] Up_eleventh = [3, 3, 2, 2, 1, 8, 7, 9, 9, 8, 11, 10, 12, 12, 11, 5, 6, 6, 5, 5] Middle_eleventh = [2, 1, 1, 3, 3, 9, 8, 8, 7, 7, 12, 12, 11, 10, 10, 4, 5, 4, 4, 6] Down_eleventh = [1, 2, 3, 1, 2, 7, 9, 7, 8, 9, 10, 11, 10, 11, 12, 6, 4, 5, 6, 4] Up_twelfth = [6, 5, 5, 6, 6, 2, 2, 3, 3, 1, 9, 7, 8, 8, 9, 12, 10, 12, 11, 11] Middle_twelfth = [4, 4, 6, 5, 4, 1, 3, 2, 1, 3, 7, 8, 7, 9, 8, 10, 12, 10, 10, 12] Down_twelfth = [5, 6, 4, 4, 5, 3, 1, 1, 2, 2, 8, 9, 9, 7, 7, 11, 11, 11, 12, 10] # Middle Down Up Up_thirteenth = [8, 8, 9, 9, 7, 10, 11, 12, 12, 10, 3, 3, 1, 1, 2, 5, 6, 6, 4, 4] Middle_thirteenth = [9, 9, 8, 7, 9, 11, 10, 11, 10, 12, 2, 1, 3, 2, 1, 6, 5, 4, 6, 5] Down_thirteenth = [7, 7, 7, 8, 8, 12, 12, 10, 11, 11, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6] Up_fourteenth = [2, 1, 1, 3, 3, 9, 8, 8, 7, 7, 12, 12, 11, 10, 10, 4, 5, 4, 4, 6] Middle_fourteenth = [1, 2, 3, 1, 2, 7, 9, 7, 8, 9, 10, 11, 10, 11, 12, 6, 4, 5, 6, 4] Down_fourteenth = [3, 3, 2, 2, 1, 8, 7, 9, 9, 8, 11, 10, 12, 12, 11, 5, 6, 6, 5, 5] Up_fifteenth = [4, 4, 6, 5, 4, 1, 3, 2, 1, 3, 7, 8, 7, 9, 8, 10, 12, 10, 10, 12] Middle_fifteenth = [5, 6, 4, 4, 5, 3, 1, 1, 2, 2, 8, 9, 9, 7, 7, 11, 11, 11, 12, 10] Down_fifteenth = [6, 5, 5, 6, 6, 2, 2, 3, 3, 1, 9, 7, 8, 8, 9, 12, 10, 12, 11, 11] # Down Up Middle Up_sixteenth = [9, 9, 8, 7, 9, 11, 10, 11, 10, 12, 2, 1, 3, 2, 1, 6, 5, 4, 6, 5] Middle_sixteenth = [7, 7, 7, 8, 8, 12, 12, 10, 11, 11, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6] Down_sixteenth = [8, 8, 9, 9, 7, 10, 11, 12, 12, 10, 3, 3, 1, 1, 2, 5, 6, 6, 4, 4] Up_seventeenth = [1, 2, 3, 1, 2, 7, 9, 7, 8, 9, 10, 11, 10, 11, 12, 6, 4, 5, 6, 4] Middle_seventeenth = [3, 3, 2, 2, 1, 8, 7, 9, 9, 8, 11, 10, 12, 12, 11, 5, 6, 6, 5, 5] Down_seventeenth = [2, 1, 1, 3, 3, 9, 8, 8, 7, 7, 12, 12, 11, 10, 10, 4, 5, 4, 4, 6] Up_eighteenth = [5, 6, 4, 4, 5, 3, 1, 1, 2, 2, 8, 9, 9, 7, 7, 11, 11, 11, 12, 10] Middle_eighteenth = [6, 5, 5, 6, 6, 2, 2, 3, 3, 1, 9, 7, 8, 8, 9, 12, 10, 12, 11, 11] Down_eighteenth = [4, 4, 6, 5, 4, 1, 3, 2, 1, 3, 7, 8, 7, 9, 8, 10, 12, 10, 10, 12] # Set 7 Up_nineteenth = [7, 7, 7, 8, 8, 4, 4, 5, 5, 6, 1, 2, 2, 3, 3, 12, 12, 10, 11, 11] Middle_nineteenth = [8, 8, 9, 9, 7, 5, 6, 6, 4, 4, 3, 3, 1, 1, 2, 10, 11, 12, 12, 10] Down_nineteenth = [9, 9, 8, 7, 9, 6, 5, 4, 6, 5, 2, 1, 3, 2, 1, 11, 10, 11, 10, 12] Up_twentieth = [8, 8, 9, 9, 7, 5, 6, 6, 4, 4, 3, 3, 1, 1, 2, 10, 11, 12, 12, 10] Middle_twentieth = [9, 9, 8, 7, 9, 6, 5, 4, 6, 5, 2, 1, 3, 2, 1, 11, 10, 11, 10, 12] Down_twentieth = [7, 7, 7, 8, 8, 4, 4, 5, 5, 6, 1, 2, 2, 3, 3, 12, 12, 10, 11, 11] self.session.vars['Up'] = [Up_first, Up_second, Up_third, Up_fourth, Up_fifth, Up_sixth, Up_seventh, Up_eighth, Up_ninth, Up_tenth, Up_eleventh, Up_twelfth, Up_thirteenth, Up_fourteenth, Up_fifteenth, Up_sixteenth, Up_seventeenth, Up_eighteenth, Up_nineteenth, Up_twentieth] self.session.vars['Middle'] = [Middle_first, Middle_second, Middle_third, Middle_fourth, Middle_fifth, Middle_sixth, Middle_seventh, Middle_eighth, Middle_ninth, Middle_tenth, Middle_eleventh, Middle_twelfth, Middle_thirteenth, Middle_fourteenth, Middle_fifteenth, Middle_sixteenth, Middle_seventeenth, Middle_eighteenth, Middle_nineteenth, Middle_twentieth] self.session.vars['Down'] = [Down_first, Down_second, Down_third, Down_fourth, Down_fifth, Down_sixth, Down_seventh, Down_eighth, Down_ninth, Down_tenth, Down_eleventh, Down_twelfth, Down_thirteenth, Down_fourteenth, Down_fifteenth, Down_sixteenth, Down_seventeenth, Down_eighteenth, Down_nineteenth, Down_twentieth] class Group(BaseGroup): true_state = models.IntegerField(label="") profile_num = models.IntegerField(label="") message = models.IntegerField(label="") guess = models.IntegerField(label="") report_first = models.IntegerField(label="") report_second = models.IntegerField(label="") report_third = models.IntegerField(label="") report_fourth = models.IntegerField(label="") report_fifth = models.IntegerField(label="") report_sixth = models.IntegerField(label="") report_seventh = models.IntegerField(label="") report_eighth = models.IntegerField(label="") report_ninth = models.IntegerField(label="") report_tenth = models.IntegerField(label="") report_eleventh = models.IntegerField(label="") report_twelfth = models.IntegerField(label="") report_thirteenth = models.IntegerField(label="") report_fourteenth = models.IntegerField(label="") report_fifteenth = models.IntegerField(label="") report_sixteenth = models.IntegerField(label="") report_seventeenth = models.IntegerField(label="") report_eighteenth = models.IntegerField(label="") report_nineteenth = models.IntegerField(label="") report_twentieth = models.IntegerField(label="") attribute_first = models.IntegerField(label="") attribute_second = models.IntegerField(label="") attribute_third = models.IntegerField(label="") attribute_fourth = models.IntegerField(label="") attribute_fifth = models.IntegerField(label="") attribute_sixth = models.IntegerField(label="") attribute_seventh = models.IntegerField(label="") attribute_eighth = models.IntegerField(label="") attribute_ninth = models.IntegerField(label="") attribute_tenth = models.IntegerField(label="") attribute_eleventh = models.IntegerField(label="") attribute_twelfth = models.IntegerField(label="") attribute_thirteenth = models.IntegerField(label="") attribute_fourteenth = models.IntegerField(label="") attribute_fifteenth = models.IntegerField(label="") attribute_sixteenth = models.IntegerField(label="") attribute_seventeenth = models.IntegerField(label="") attribute_eighteenth = models.IntegerField(label="") attribute_nineteenth = models.IntegerField(label="") attribute_twentieth = models.IntegerField(label="") check_first = models.IntegerField(label="") check_second = models.IntegerField(label="") check_third = models.IntegerField(label="") check_fourth = models.IntegerField(label="") check_fifth = models.IntegerField(label="") check_sixth = models.IntegerField(label="") check_seventh = models.IntegerField(label="") check_eighth = models.IntegerField(label="") check_ninth = models.IntegerField(label="") check_tenth = models.IntegerField(label="") check_eleventh = models.IntegerField(label="") check_twelfth = models.IntegerField(label="") check_thirteenth = models.IntegerField(label="") check_fourteenth = models.IntegerField(label="") check_fifteenth = models.IntegerField(label="") check_sixteenth = models.IntegerField(label="") check_seventeenth = models.IntegerField(label="") check_eighteenth = models.IntegerField(label="") check_nineteenth = models.IntegerField(label="") check_twentieth = models.IntegerField(label="") correct = models.IntegerField(label="") def message_choices(self): return [[1, 'Up'], [2, 'Middle'], [3, 'Down']] def report_first_choices(self): return [[1, 'White'], [2, 'Orange'], [3, 'Grey'], [4, 'Purple'], [5, 'Red'], [6, 'Blue'], [7, 'Pink'], [8, 'Yellow'], [9, 'Green'], [10, 'Maroon'], [11, 'Black'], [12, 'Navy']] def report_second_choices(self): return [[1, 'Square'], [2, 'Round'], [3, 'Triangle'], [4, 'Heart'], [5, 'Parallelogram'], [6, 'Cross'], [7, 'Pentagon'], [8, 'Diamond'], [9, 'Star'], [10, 'Drop'], [11, 'Moon'], [12, 'Cubic']] def report_third_choices(self): return [[1, 'B'], [2, 'F'], [3, 'J'], [4, 'D'], [5,'G'], [6, 'M'], [7, 'E'], [8, 'L'], [9, 'K'], [10, 'A'], [11,'H'], [12,'P']] def report_fourth_choices(self): return [[1, '2'], [2, '11'], [3, '18'], [4, '6'], [5, '9'], [6, '15'], [7, '8'], [8, '13'], [9, '19'], [10, '7'], [11, '12'], [12, '16']] def report_fifth_choices(self): return [[1, '\u002B'], [2, '\u2212'], [3, '\u00D7'], [4, '\u003C'], [5, '\u003E'], [6, '\u003D'], [7, '\u221A'], [8, '\u0025'], [9, '\u00F7'], [10, '\u2229'], [11, '\u2205'], [12, '\u221E']] def report_sixth_choices(self): return [[1, 'White'], [2, 'Orange'], [3, 'Grey'], [4, 'Purple'], [5, 'Red'], [6, 'Blue'], [7, 'Pink'], [8, 'Yellow'], [9, 'Green'], [10, 'Maroon'], [11, 'Black'], [12, 'Navy']] def report_seventh_choices(self): return [[1, 'Square'], [2, 'Round'], [3, 'Triangle'], [4, 'Heart'], [5, 'Parallelogram'], [6, 'Cross'], [7, 'Pentagon'], [8, 'Diamond'], [9, 'Star'], [10, 'Drop'], [11, 'Moon'], [12, 'Cubic']] def report_eighth_choices(self): return [[1, 'B'], [2, 'F'], [3, 'J'], [4, 'D'], [5, 'G'], [6, 'M'], [7, 'E'], [8, 'L'], [9, 'K'], [10, 'A'], [11, 'H'], [12, 'P']] def report_ninth_choices(self): return [[1, '2'], [2, '11'], [3, '18'], [4, '6'], [5, '9'], [6, '15'], [7, '8'], [8, '13'], [9, '19'], [10, '7'], [11, '12'], [12, '16']] def report_tenth_choices(self): return [[1, '\u002B'], [2, '\u2212'], [3, '\u00D7'], [4, '\u003C'], [5, '\u003E'], [6, '\u003D'], [7, '\u221A'], [8, '\u0025'], [9, '\u00F7'], [10, '\u2229'], [11, '\u2205'], [12, '\u221E']] def report_eleventh_choices(self): return [[1, 'White'], [2, 'Orange'], [3, 'Grey'], [4, 'Purple'], [5, 'Red'], [6, 'Blue'], [7, 'Pink'], [8, 'Yellow'], [9, 'Green'], [10, 'Maroon'], [11, 'Black'], [12, 'Navy']] def report_twelfth_choices(self): return [[1, 'Square'], [2, 'Round'], [3, 'Triangle'], [4, 'Heart'], [5, 'Parallelogram'], [6, 'Cross'], [7, 'Pentagon'], [8, 'Diamond'], [9, 'Star'], [10, 'Drop'], [11, 'Moon'], [12, 'Cubic']] def report_thirteenth_choices(self): return [[1, 'B'], [2, 'F'], [3, 'J'], [4, 'D'], [5, 'G'], [6, 'M'], [7, 'E'], [8, 'L'], [9, 'K'], [10, 'A'], [11, 'H'], [12, 'P']] def report_fourteenth_choices(self): return [[1, '2'], [2, '11'], [3, '18'], [4, '6'], [5, '9'], [6, '15'], [7, '8'], [8, '13'], [9, '19'], [10, '7'], [11, '12'], [12, '16']] def report_fifteenth_choices(self): return [[1, '\u002B'], [2, '\u2212'], [3, '\u00D7'], [4, '\u003C'], [5, '\u003E'], [6, '\u003D'], [7, '\u221A'], [8, '\u0025'], [9, '\u00F7'], [10, '\u2229'], [11, '\u2205'], [12, '\u221E']] def report_sixteenth_choices(self): return [[1, 'White'], [2, 'Orange'], [3, 'Grey'], [4, 'Purple'], [5, 'Red'], [6, 'Blue'], [7, 'Pink'], [8, 'Yellow'], [9, 'Green'], [10, 'Maroon'], [11, 'Black'], [12, 'Navy']] def report_seventeenth_choices(self): return [[1, 'Square'], [2, 'Round'], [3, 'Triangle'], [4, 'Heart'], [5, 'Parallelogram'], [6, 'Cross'], [7, 'Pentagon'], [8, 'Diamond'], [9, 'Star'], [10, 'Drop'], [11, 'Moon'], [12, 'Cubic']] def report_eighteenth_choices(self): return [[1, 'B'], [2, 'F'], [3, 'J'], [4, 'D'], [5, 'G'], [6, 'M'], [7, 'E'], [8, 'L'], [9, 'K'], [10, 'A'], [11, 'H'], [12, 'P']] def report_nineteenth_choices(self): return [[1, '2'], [2, '11'], [3, '18'], [4, '6'], [5, '9'], [6, '15'], [7, '8'], [8, '13'], [9, '19'], [10, '7'], [11, '12'], [12, '16']] def report_twentieth_choices(self): return [[1, '\u002B'], [2, '\u2212'], [3, '\u00D7'], [4, '\u003C'], [5, '\u003E'], [6, '\u003D'], [7, '\u221A'], [8, '\u0025'], [9, '\u00F7'], [10, '\u2229'], [11, '\u2205'], [12, '\u221E']] def guess_choices(self): return[[1, 'Up'], [2, 'Middle'], [3, 'Down']] def get_state(self): self.true_state = random.choices([1, 2, 3], weights = [Constants.initial_prior, Constants.initial_prior, Constants.initial_prior])[0] print(self.true_state) return self.true_state def get_correct_attributes(self): # print(self.session.vars['Up']) # print(self.session.vars['Middle']) # print(self.session.vars['Down']) if self.message == 1: self.attribute_first = self.session.vars['Up'][self.round_number - 1][0] self.attribute_second = self.session.vars['Up'][self.round_number - 1][1] self.attribute_third = self.session.vars['Up'][self.round_number - 1][2] self.attribute_fourth = self.session.vars['Up'][self.round_number - 1][3] self.attribute_fifth = self.session.vars['Up'][self.round_number - 1][4] self.attribute_sixth = self.session.vars['Up'][self.round_number - 1][5] self.attribute_seventh = self.session.vars['Up'][self.round_number - 1][6] self.attribute_eighth = self.session.vars['Up'][self.round_number - 1][7] self.attribute_ninth = self.session.vars['Up'][self.round_number - 1][8] self.attribute_tenth = self.session.vars['Up'][self.round_number - 1][9] self.attribute_eleventh = self.session.vars['Up'][self.round_number - 1][10] self.attribute_twelfth = self.session.vars['Up'][self.round_number - 1][11] self.attribute_thirteenth = self.session.vars['Up'][self.round_number - 1][12] self.attribute_fourteenth = self.session.vars['Up'][self.round_number - 1][13] self.attribute_fifteenth = self.session.vars['Up'][self.round_number - 1][14] self.attribute_sixteenth = self.session.vars['Up'][self.round_number - 1][15] self.attribute_seventeenth = self.session.vars['Up'][self.round_number - 1][16] self.attribute_eighteenth = self.session.vars['Up'][self.round_number - 1][17] self.attribute_nineteenth = self.session.vars['Up'][self.round_number - 1][18] self.attribute_twentieth = self.session.vars['Up'][self.round_number - 1][19] elif self.message == 2: self.attribute_first = self.session.vars['Middle'][self.round_number - 1][0] self.attribute_second = self.session.vars['Middle'][self.round_number - 1][1] self.attribute_third = self.session.vars['Middle'][self.round_number - 1][2] self.attribute_fourth = self.session.vars['Middle'][self.round_number - 1][3] self.attribute_fifth = self.session.vars['Middle'][self.round_number - 1][4] self.attribute_sixth = self.session.vars['Middle'][self.round_number - 1][5] self.attribute_seventh = self.session.vars['Middle'][self.round_number - 1][6] self.attribute_eighth = self.session.vars['Middle'][self.round_number - 1][7] self.attribute_ninth = self.session.vars['Middle'][self.round_number - 1][8] self.attribute_tenth = self.session.vars['Middle'][self.round_number - 1][9] self.attribute_eleventh = self.session.vars['Middle'][self.round_number - 1][10] self.attribute_twelfth = self.session.vars['Middle'][self.round_number - 1][11] self.attribute_thirteenth = self.session.vars['Middle'][self.round_number - 1][12] self.attribute_fourteenth = self.session.vars['Middle'][self.round_number - 1][13] self.attribute_fifteenth = self.session.vars['Middle'][self.round_number - 1][14] self.attribute_sixteenth = self.session.vars['Middle'][self.round_number - 1][15] self.attribute_seventeenth = self.session.vars['Middle'][self.round_number - 1][16] self.attribute_eighteenth = self.session.vars['Middle'][self.round_number - 1][17] self.attribute_nineteenth = self.session.vars['Middle'][self.round_number - 1][18] self.attribute_twentieth = self.session.vars['Middle'][self.round_number - 1][19] else: self.attribute_first = self.session.vars['Down'][self.round_number - 1][0] self.attribute_second = self.session.vars['Down'][self.round_number - 1][1] self.attribute_third = self.session.vars['Down'][self.round_number - 1][2] self.attribute_fourth = self.session.vars['Down'][self.round_number - 1][3] self.attribute_fifth = self.session.vars['Down'][self.round_number - 1][4] self.attribute_sixth = self.session.vars['Down'][self.round_number - 1][5] self.attribute_seventh = self.session.vars['Down'][self.round_number - 1][6] self.attribute_eighth = self.session.vars['Down'][self.round_number - 1][7] self.attribute_ninth = self.session.vars['Down'][self.round_number - 1][8] self.attribute_tenth = self.session.vars['Down'][self.round_number - 1][9] self.attribute_eleventh = self.session.vars['Down'][self.round_number - 1][10] self.attribute_twelfth = self.session.vars['Down'][self.round_number - 1][11] self.attribute_thirteenth = self.session.vars['Down'][self.round_number - 1][12] self.attribute_fourteenth = self.session.vars['Down'][self.round_number - 1][13] self.attribute_fifteenth = self.session.vars['Down'][self.round_number - 1][14] self.attribute_sixteenth = self.session.vars['Down'][self.round_number - 1][15] self.attribute_seventeenth = self.session.vars['Down'][self.round_number - 1][16] self.attribute_eighteenth = self.session.vars['Down'][self.round_number - 1][17] self.attribute_nineteenth = self.session.vars['Down'][self.round_number - 1][18] self.attribute_twentieth = self.session.vars['Down'][self.round_number - 1][19] return self.attribute_first, self.attribute_second, self.attribute_third, self.attribute_fourth, self.attribute_fifth, self.attribute_sixth, self.attribute_seventh, self.attribute_eighth, self.attribute_ninth, self.attribute_tenth, self.attribute_eleventh, self.attribute_twelfth, self.attribute_thirteenth, self.attribute_fourteenth, self.attribute_fifteenth, self.attribute_sixteenth, self.attribute_seventeenth, self.attribute_eighteenth, self.attribute_nineteenth, self.attribute_twentieth def get_check_first(self): if self.attribute_first == self.report_first: self.check_first = 1 else: self.check_first = 0 def get_check_second(self): if self.attribute_second == self.report_second: self.check_second = 1 else: self.check_second = 0 def get_check_third(self): if self.attribute_third == self.report_third: self.check_third = 1 else: self.check_third = 0 def get_check_fourth(self): if self.attribute_fourth == self.report_fourth: self.check_fourth = 1 else: self.check_fourth = 0 def get_check_fifth(self): if self.attribute_fifth == self.report_fifth: self.check_fifth = 1 else: self.check_fifth = 0 def get_check_sixth(self): if self.attribute_sixth == self.report_sixth: self.check_sixth = 1 else: self.check_sixth = 0 def get_check_seventh(self): if self.attribute_seventh == self.report_seventh: self.check_seventh = 1 else: self.check_seventh = 0 def get_check_eighth(self): if self.attribute_eighth == self.report_eighth: self.check_eighth = 1 else: self.check_eighth = 0 def get_check_ninth(self): if self.attribute_ninth == self.report_ninth: self.check_ninth = 1 else: self.check_ninth = 0 def get_check_tenth(self): if self.attribute_tenth == self.report_tenth: self.check_tenth = 1 else: self.check_tenth = 0 def get_check_eleventh(self): if self.attribute_eleventh == self.report_eleventh: self.check_eleventh = 1 else: self.check_eleventh = 0 def get_check_twelfth(self): if self.attribute_twelfth == self.report_twelfth: self.check_twelfth = 1 else: self.check_twelfth = 0 def get_check_thirteenth(self): if self.attribute_thirteenth == self.report_thirteenth: self.check_thirteenth = 1 else: self.check_thirteenth = 0 def get_check_fourteenth(self): if self.attribute_fourteenth == self.report_fourteenth: self.check_fourteenth = 1 else: self.check_fourteenth = 0 def get_check_fifteenth(self): if self.attribute_fifteenth == self.report_fifteenth: self.check_fifteenth = 1 else: self.check_fifteenth = 0 def get_check_sixteenth(self): if self.attribute_sixteenth == self.report_sixteenth: self.check_sixteenth = 1 else: self.check_sixteenth = 0 def get_check_seventeenth(self): if self.attribute_seventeenth == self.report_seventeenth: self.check_seventeenth = 1 else: self.check_seventeenth = 0 def get_check_eighteenth(self): if self.attribute_eighteenth == self.report_eighteenth: self.check_eighteenth = 1 else: self.check_eighteenth = 0 def get_check_nineteenth(self): if self.attribute_nineteenth == self.report_nineteenth: self.check_nineteenth = 1 else: self.check_nineteenth = 0 def get_check_twentieth(self): if self.attribute_twentieth == self.report_twentieth: self.check_twentieth = 1 else: self.check_twentieth = 0 def get_correct(self): self.correct = self.check_first + self.check_second + self.check_third + self.check_fourth + self.check_fifth + self.check_sixth + self.check_seventh + self.check_eighth + self.check_ninth + \ self.check_tenth + self.check_eleventh + self.check_twelfth + self.check_thirteenth + self.check_fourteenth + self.check_fifteenth + self.check_sixteenth + self.check_seventeenth + self.check_eighteenth + self.check_nineteenth + self.check_twentieth return self.correct #when the final set is decided, add a function to examine whether the sender is truthfully reporting. class Player(BasePlayer): round_payoff = models.CurrencyField() other_payoff = models.CurrencyField() def role(self): if self.id_in_group == 1: return 'Sender' else: return 'Receiver'