from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import itertools import numpy as np from django import forms from django.forms import widgets as django_widgets import math author = 'Jindi Huang' class Constants(BaseConstants): name_in_url = 'instructions_stage2' players_per_group = None num_rounds = 1 attention1_options = [ ['1', "Extremely interested"], ['2', "Very interested"], ['3', "A little bit interested"], ['4', "Very little interested"], ['5', "Not at all interested"] ] list1 = np.arange(1 * 20, - 1, -1) list2 = [] list2.append(0) for x in range(20): list2.append((x+1)*5) class Subsession(BaseSubsession): def creating_session(self): if self.round_number == 1: for p in self.get_players(): p.participant.vars['attention_got_wrong'] = False p.participant.vars['correct_num'] = 12 p.participant.vars['failed_comprehension'] = False p.participant.vars['open_link'] = 0 class Group(BaseGroup): pass class Player(BasePlayer): prolific_id = models.StringField(label="") def prolific_id_error_message(self, value): if len(value) != 24: return "The prolific ID should have 24 alphanumeric characters." attention2_check = models.StringField( blank=True, label="" ) attention_got_wrong = models.BooleanField(initial=False) failed_comprehension = models.BooleanField(initial=False) qn_procedure1_got_wrong = models.BooleanField(initial=False) qn_procedure2_got_wrong = models.BooleanField(initial=False) qn_confidence_got_wrong = models.BooleanField(initial=False) qn_procedure1 = models.IntegerField( choices=[ [0, 'If I state low certainty in an auction, I should also indicate low certainty in all other auctions.'], [1, 'Because I may be more certain about my ability to play optimally in some auctions than in others, I might expect to get closer to Optimal Earnings in some auctions compared to others.'], ], widget=widgets.RadioSelect, blank=False, label="" ) qn_procedure2 = models.IntegerField( choices=[ [1, 'To maximize my earnings in this study, I should always honestly report my level of certainty that I will play optimally, and then try to bid as well as I can in the auction.'], [0, 'To maximize my earnings, I should try to strategize across questions, and sometime indicate high certainty even when I am actually not very certain that I will make optimal decisions in the auction.'], [0, 'To maximize my earnings, I should indicate artificially low certainty, and then make decisions in the auction that I know are sub-optimal.'], ], widget=widgets.RadioSelect, blank=False, label="" ) qn_confidence = models.FloatField( blank=False, label="" ) open_link = models.IntegerField(blank=True) skip = models.IntegerField(blank=True)