from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random class Constants(BaseConstants): name_in_url = 'survey' players_per_group = None num_rounds = 3 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def choices(): choice00000 = (0, 1) #0 is with distractions and 1 is without distractions but with point deducted return choice00000 def budget(): budget00000 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) return budget00000 class Player(BasePlayer): time_spent = models.FloatField() points = models.IntegerField() score_on_display = models.IntegerField() total_green = models.IntegerField() total_gray = models.IntegerField() total_wrong = models.IntegerField() total_right = models.IntegerField() wrong_green = models.IntegerField() #correct should be green wrong_gray = models.IntegerField() #correct should be gray right_green = models.IntegerField() right_gray = models.IntegerField() board_history = models.LongStringField() #if each cell is correct or not (1 for correct color, 0 for wrong color) time_between_moves = models.LongStringField() solve_order = models.LongStringField() total_wrong_adding_no_distraction = models.IntegerField() final_points_no_distraction = models.FloatField(max=30, min=0) final_payoff_no_distraction = models.FloatField(max=30, min=0) game_finished = models.IntegerField() adding_numbers1_correct = models.IntegerField() adding_numbers1_time_spent = models.FloatField() adding_numbers2_correct = models.IntegerField() adding_numbers2_time_spent = models.FloatField() adding_numbers3_correct = models.IntegerField() adding_numbers3_time_spent = models.FloatField() adding_numbers4_correct = models.IntegerField() adding_numbers4_time_spent = models.FloatField() adding_numbers5_correct = models.IntegerField() adding_numbers5_time_spent = models.FloatField() time_spent_podcast = models.FloatField() points_podcast = models.IntegerField() score_on_display_podcast = models.IntegerField() total_green_podcast = models.IntegerField() total_gray_podcast = models.IntegerField() total_wrong_podcast = models.IntegerField() total_right_podcast = models.IntegerField() wrong_green_podcast = models.IntegerField() #correct should be green wrong_gray_podcast = models.IntegerField() #correct should be gray right_green_podcast = models.IntegerField() right_gray_podcast = models.IntegerField() board_history_podcast = models.LongStringField() #if each cell is correct or not (1 for correct color, 0 for wrong color) time_between_moves_podcast = models.LongStringField() solve_order_podcast = models.LongStringField() total_wrong_adding_podcast = models.IntegerField() final_points_podcast = models.FloatField(max=30, min=0) final_payoff_podcast = models.FloatField(max=30, min=0) game_finished_podcast = models.IntegerField() adding_numbers1_correct_podcast = models.IntegerField() adding_numbers1_time_spent_podcast = models.FloatField() adding_numbers2_correct_podcast = models.IntegerField() adding_numbers2_time_spent_podcast = models.FloatField() adding_numbers3_correct_podcast = models.IntegerField() adding_numbers3_time_spent_podcast = models.FloatField() adding_numbers4_correct_podcast = models.IntegerField() adding_numbers4_time_spent_podcast = models.FloatField() adding_numbers5_correct_podcast = models.IntegerField() adding_numbers5_time_spent_podcast = models.FloatField() interruption_time = models.LongStringField() time_spent_total1 = models.FloatField() time_spent_nono1 = models.FloatField() points1 = models.IntegerField() #is the points for current game score_on_display1 = models.IntegerField() #is the total points for all games if a game 2 or 3 is present total_green1 = models.IntegerField() total_gray1 = models.IntegerField() total_wrong1 = models.IntegerField() total_right1 = models.IntegerField() wrong_green1 = models.IntegerField() #correct should be green wrong_gray1 = models.IntegerField() #correct should be gray right_green1 = models.IntegerField() right_gray1 = models.IntegerField() board_history1 = models.LongStringField() #if each cell is correct or not (1 for correct color, 0 for wrong color) time_between_moves1 = models.LongStringField() solve_order1 = models.LongStringField() #number of the tile indicates the order of it being filled (if the 5th tile is filled in the last, it has a number of 100) interruption_time1 = models.LongStringField() gap_history1 = models.LongStringField() #gap history is the time taken to solve each adding numbers task game1_finished = models.IntegerField() time_spent_total2 = models.FloatField() time_spent_nono2 = models.FloatField() points2 = models.IntegerField() #is the points for current game score_on_display2 = models.IntegerField() #is the total points for all games if a game 2 or 3 is present total_green2 = models.IntegerField() total_gray2 = models.IntegerField() total_wrong2 = models.IntegerField() total_right2 = models.IntegerField() wrong_green2 = models.IntegerField() #correct should be green wrong_gray2 = models.IntegerField() #correct should be gray right_green2 = models.IntegerField() right_gray2 = models.IntegerField() board_history2 = models.LongStringField() #if each cell is correct or not (1 for correct color, 0 for wrong color) time_between_moves2 = models.LongStringField() solve_order2 = models.LongStringField() #number of the tile indicates the order of it being filled (if the 5th tile is filled in the last, it has a number of 100) interruption_time2 = models.LongStringField() gap_history2 = models.LongStringField() #gap history is the time taken to solve each adding numbers task game2_finished = models.IntegerField() time_spent_total3 = models.FloatField() time_spent_nono3 = models.FloatField() points3 = models.IntegerField() #is the points for current game score_on_display3 = models.IntegerField() #is the total points for all games if a game 2 or 3 is present total_green3 = models.IntegerField() total_gray3 = models.IntegerField() total_wrong3 = models.IntegerField() total_right3 = models.IntegerField() wrong_green3 = models.IntegerField() #correct should be green wrong_gray3 = models.IntegerField() #correct should be gray right_green3 = models.IntegerField() right_gray3 = models.IntegerField() board_history3 = models.LongStringField() #if each cell is correct or not (1 for correct color, 0 for wrong color) time_between_moves3 = models.LongStringField() solve_order3 = models.LongStringField() #number of the tile indicates the order of it being filled (if the 5th tile is filled in the last, it has a number of 100) interruption_time3 = models.LongStringField() gap_history3 = models.LongStringField() #gap history is the time taken to solve each adding numbers task game3_finished = models.IntegerField() gap_history = models.LongStringField() total_wrong_adding_forced = models.IntegerField() final_points_forced = models.FloatField(max=30, min=0) final_payoff_forced = models.FloatField(max=30, min=0) decision_chosen = models.IntegerField() multiple_switching1 = models.IntegerField() multiple_switching2 = models.IntegerField() multiple_switching1_1 = models.IntegerField() multiple_switching2_1 = models.IntegerField() choice1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[0]) + ' point deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice2 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[1]) + ' point deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice3 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[2]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice4 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[3]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice5 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[4]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice6 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[5]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice7 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[6]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice8 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[7]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice9 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[8]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice10 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[9]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice11 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[10]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice12 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[0]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice13 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[1]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice14 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[2]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice15 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[3]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice16 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[4]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice17 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[5]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice18 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[6]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice19 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[7]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice20 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[8]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice21 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[9]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice22 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[10]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice1_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[0]) + ' point deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice2_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[1]) + ' point deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice3_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[2]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice4_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[3]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice5_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[4]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice6_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[5]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice7_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[6]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice8_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[7]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice9_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[8]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice10_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[9]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice11_1 = models.StringField( choices=[ [str(choices()[0]), 'Interruptions'], [str(choices()[1]), 'Sequential with ' + str(budget()[10]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice12_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[0]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice13_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[1]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice14_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[2]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice15_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[3]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice16_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[4]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice17_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[5]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice18_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[6]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice19_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[7]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice20_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[8]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice21_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[9]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal ) choice22_1 = models.StringField( choices=[ [str(choices()[0]), 'Conversation'], [str(choices()[1]), 'Sequential with ' + str(budget()[10]) + ' points deducted'], ], label="", widget=widgets.RadioSelectHorizontal )