from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random import time author = 'Tee Kai Hong' doc = """ MR standard """ #instructions for participants std_instructions = "Please choose only one option. You will recieve payment if and only if the chosen option is the correct one." rand_instructions = "You may choose either one option or multiple options. If you chose only 1 answer, that will be your final answer for this question. If multiple options are selected, one of them will be randomly chosen to be your final answer." split_instructions = "You may choose either one option or multiple options. If you chose only 1 answer, that will be your final answer for this question. If multiple options are selected and it contains the correct answer, the payment for this question will be divided by the number of options you have selected." class Constants(BaseConstants): name_in_url = 'MR' players_per_group = None #matrix_index = list(range(1,12)) num_rounds = 32 #answer_key = [3,2,4,1,1,3,4,2,0,3,4] #answer_dict = {0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E', 5: 'F'} trmt_instructions = { 'std': std_instructions, 'rand': rand_instructions, 'split': split_instructions } class Subsession(BaseSubsession): def creating_session(self): #add question id and answer into data table for p in self.get_players(): p.matrixno = p.participant.vars['qn_order'][self.round_number - 1][2] p.correct_answer = p.participant.vars['qn_order'][self.round_number - 1][0] class Group(BaseGroup): pass class Player(BasePlayer): response1 = models.BooleanField(blank= True, label='1', widget=widgets.CheckboxInput) response2 = models.BooleanField(blank= True, label='2', widget=widgets.CheckboxInput) response3 = models.BooleanField(blank= True, label='3', widget=widgets.CheckboxInput) response4 = models.BooleanField(blank= True, label='4', widget=widgets.CheckboxInput) response5 = models.BooleanField(blank= True, label='5', widget=widgets.CheckboxInput) response6 = models.BooleanField(blank= True, label='6', widget=widgets.CheckboxInput) response7 = models.BooleanField(blank= True, label='7', widget=widgets.CheckboxInput) response8 = models.BooleanField(blank= True, label='8', widget=widgets.CheckboxInput) matrixno = models.IntegerField() correct_answer = models.IntegerField()