Example #1
0
class Player(BasePlayer):

    ## method to get questoin from CSV file questions
    def current_question(self):
        return self.session.vars['questions'][self.round_number - 1]

    def role(self):
        if self.id_in_group % 3 == 0:
            return 'roomB'
        else:
            return 'roomA'

    ## player timer. The task timer is called and initiated when the task starts
    task_timer = models.PositiveIntegerField()

    ## used to store name that is entered by the player
    name = models.StringField()

    ## Excel file with nametags - entire file : this file has a unique set of names for each letter in the alphabet
    loc = 'complex_math/nametags.xlsx'
    nametagBook = xlrd.open_workbook(loc)

    ## this variable is the nametag that the player selects. The nametag choices for this variable are determined during the game
    nametag = models.StringField()

    ## variable that stores the name that the 'chooser' selected during the team selection page
    sentNames = models.StringField()

    ## these variables store data relating to the player and selector task
    int1 = models.PositiveIntegerField()
    int2 = models.PositiveIntegerField()
    solution = models.PositiveIntegerField()
    user_total = models.PositiveIntegerField(
        min=1,
        max=9999,
        widget=widgets.TextInput(attrs={'autocomplete': 'off'}))

    task1payoff_score = models.FloatField()
    task2payoff_score = models.FloatField()
    '''
    the score_task methods are called to update a players taskpayoff score.
    there are two methods and are used for the seperate task1 and task2
    '''

    def score_task1(self):
        if self.solution == self.user_total:
            self.task1payoff_score = 1.0
        else:
            self.task1payoff_score = 0.0

    def score_task2(self):
        if self.solution == self.user_total:
            self.task2payoff_score = 1.0
        else:
            self.task2payoff_score = 0.0
Example #2
0
class Player(BasePlayer):

    rank_before_sabotage = models.IntegerField()
    rank_after_sabotage = models.IntegerField()
    rank_after_feedback = models.IntegerField()

    rank_before_sabotage_str = models.StringField()

    payoff_before_sabotage = models.IntegerField()
    payoff_after_sabotage = models.IntegerField()
    payoff_after_feedback = models.IntegerField()

    payoff_sabotage = models.IntegerField(initial=0)
    payoff_belief = models.IntegerField(initial=0)

    total_correct_after_sabotage = models.FloatField(initial=0)
    total_correct_after_feedback = models.FloatField(initial=0)
    total_correct = models.FloatField(initial=0)

    # sabotage = models.IntegerField(
    #     choices=[
    #         [0, '0'],
    #         [5, '5'],
    #         [10, '10'],
    #         [15, '15'],
    #         [20, '20'],
    #         [25, '25'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label=""
    # )

    # sabotage_belief = models.IntegerField(
    #     choices=[
    #         [0, '0'],
    #         [5, '5'],
    #         [10, '10'],
    #         [15, '15'],
    #         [20, '20'],
    #         [25, '25'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label=""
    # )

    sabotage = models.IntegerField(min=0, max=50, label="Lütfen diğer oyuncudan kaç TL değerinde doğru eksiltmek istediğizi seçiniz. (Lütfen boşluğa 0 ile 50 arasında bir sayı giriniz)")
    sabotage_belief = models.IntegerField(min=0, max=50, label="")
    sabotage_post = models.IntegerField(min=0, max=50, label="Lütfen diğer oyuncudan kaç TL değerinde doğru eksiltmek istediğizi seçiniz. (Lütfen boşluğa 0 ile 50 arasında bir sayı giriniz)")

    belief = models.IntegerField(
        choices=[
            [1, 'Birinci'],
            [2, 'İkinci'],
        ],
        widget=widgets.RadioSelect,
        label=""
    )

    task_timer = models.PositiveIntegerField(
        doc="""The length of the real effort task timer."""
    )

    correct_text = models.CharField(
        doc="user's transcribed text")

    user_text = models.CharField(
        doc="user's transcribed text",
        widget=widgets.TextInput(attrs={'autocomplete':'off'}))

    is_correct = models.BooleanField(
        doc="did the user get the task correct?")

    ret_final_score = models.IntegerField(
        doc="player's total score up to this round")

    payoff_score = models.IntegerField(initial=0, doc = '''score in this task''')

    is_winner = models.BooleanField()

    rank = models.IntegerField()
    rank_str = models.StringField()

    other_male = models.IntegerField(initial=0)
    other_avatar = models.StringField(initial='male')


    #
    # def set_belief_payoffs(self):
    #
    #     if self.rank == self.belief:
    #         self.payoff_belief = 5
    #     else:
    #         self.payoff_belief = 0

    def score_round(self):
        # update player payoffs
        if self.correct_text == self.user_text:
            self.is_correct = True
            self.payoff_score = 1
        else:
            self.is_correct = False
            self.payoff_score = 0
Example #3
0
class Player(BasePlayer):
    #time_Facebook = models.LongStringField()
    time_Instructions = models.LongStringField()
    time_tetris = models.LongStringField()
    time_TetrisResults = models.LongStringField()
    time_Charity = models.LongStringField()
    time_ControlQuestions = models.LongStringField()
    time_ModeInstructionsCQ = models.LongStringField()
    time_InstructionSummary = models.LongStringField()
    time_TaskInstructions = models.LongStringField()
    time_Decision = models.LongStringField()
    time_Results = models.LongStringField()
    time_Survey = models.LongStringField()

    endowment = models.IntegerField()
    # players first choose a charity.
    # otree's dropdown menus need to return an integer
    charity = models.IntegerField()
    donated_yes_no = models.BooleanField(choices=[[0, 'No'], [1, 'Yes']],
                                         widget=widgets.RadioSelect)
    money_kept = models.FloatField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    money_donated = models.IntegerField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))

    exit_choice_available = models.BooleanField()
    exit_choice = models.BooleanField(choices=[[0, 'No'], [1, 'Yes']],
                                      widget=widgets.RadioSelect)
    exit_amount = models.FloatField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))

    mode = models.LongStringField()
    rebate = models.FloatField()

    # this is the charity's name. It gets returned in Decision and results
    charity_dec = models.LongStringField()

    #facebook page
    FB_name = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    FB_ID = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))

    # results page
    chosen_pr = models.IntegerField()
    chosen_mode = models.StringField()
    chosen_charity = models.StringField()
    chosen_rebate = models.FloatField()
    chosen_donation = models.FloatField()

    # survey
    s1 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s2 = models.IntegerField(widget=widgets.NumberInput(
        attrs={'autocomplete': 'off'}))
    s3 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s4 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s5 = models.BooleanField(choices=[[0, 'No'], [1, 'Yes']],
                             widget=widgets.RadioSelect)
    s6 = models.IntegerField(choices=[[0, 'No'], [1, 'Yes, part-time'],
                                      [2, 'Yes, full-time']],
                             widget=widgets.RadioSelect)
    s7 = models.IntegerField()
    s8 = models.IntegerField(widget=widgets.RadioSelect)
    s9a = models.IntegerField()
    s9b = models.IntegerField()
    s10a = models.IntegerField()
    s10b = models.IntegerField()
    s11a = models.IntegerField()
    s11b = models.IntegerField()
    s12 = models.IntegerField(choices=[[0, 'At least once a day'],
                                       [1, 'At least once a week'],
                                       [2, 'At least once a month'],
                                       [3, 'I rarely use Facebook']],
                              widget=widgets.RadioSelect)
    s13 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s14 = models.IntegerField(choices=[
        [0, 'The rebate makes my donation appear less generous'],
        [
            1,
            'The rebate has an advertising effect that will attract more friends to donate'
        ]
    ],
                              widget=widgets.RadioSelect)
    s15a = models.IntegerField(
        widget=widgets.NumberInput(attrs={'autocomplete': 'off'}),
        label='Thank you, \'your name\', for donating $10 to ARC!')
    s15b = models.IntegerField(
        widget=widgets.NumberInput(attrs={'autocomplete': 'off'}),
        label=
        'Thank you, \'your name\', for donating $10 to ARC, with the LEEPS Lab offering a $5 rebate to you!'
    )
    s15c = models.IntegerField(
        widget=widgets.NumberInput(attrs={'autocomplete': 'off'}),
        label=
        'Thank you, \'your name\', for donating $5 to ARC, with the LEEPS Lab matching $5. ARC received $10 total in donations!'
    )

    # pr is the paying round: this is randomly chosen
    # in creating_session
    def set_payoffs(self, pr):
        # gets money kept in paying round
        kept = self.in_round(pr).money_kept
        donated = self.in_round(pr).money_donated
        rebate = Constants.round_data[self.participant.id_in_session - 1][pr -
                                                                          1][1]

        # multiplies money kept by rebate to get total payoff
        self.payoff = kept + (donated * (rebate - 1))
Example #4
0
class Player(BasePlayer):
    #time_Facebook = models.LongStringField()
    time_Instructions = models.LongStringField()
    time_ControlQuestions = models.LongStringField()
    time_Charity = models.LongStringField()
    time_ModeInstructionsCQ = models.LongStringField()
    time_InstructionSummary = models.LongStringField()
    time_TaskInstructions = models.LongStringField()
    time_Decision = models.LongStringField()
    time_Results = models.LongStringField()
    time_Survey = models.LongStringField()

    # players first choose a charity.
    # otree's dropdown menus need to return an integer
    charity = models.IntegerField()

    money_kept = models.FloatField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    money_donated = models.IntegerField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))

    mode = models.LongStringField()
    rebate = models.FloatField()

    # this is the charity's name. It gets returned in Decision and results
    charity_dec = models.LongStringField()

    #facebook page
    FB_name = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    FB_ID = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))

    # results page
    chosen_pr = models.IntegerField()
    chosen_mode = models.StringField()
    chosen_charity = models.StringField()
    chosen_rebate = models.FloatField()
    chosen_donation = models.FloatField()

    # survey
    s1 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s2 = models.IntegerField(widget=widgets.NumberInput(
        attrs={'autocomplete': 'off'}))
    s3 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s4 = models.StringField(widget=widgets.TextInput(
        attrs={'autocomplete': 'off'}))
    s5 = models.BooleanField(choices=[[0, 'No'], [1, 'Yes']],
                             widget=widgets.RadioSelect)
    s6 = models.IntegerField(choices=[[0, 'No'], [1, 'Yes, part-time'],
                                      [2, 'Yes, full-time']],
                             widget=widgets.RadioSelect)
    s7 = models.IntegerField()
    s8 = models.IntegerField(widget=widgets.RadioSelect)
    s9a = models.IntegerField()
    s9b = models.IntegerField()
    s10a = models.IntegerField()
    s10b = models.IntegerField()
    s11a = models.IntegerField()
    s11b = models.IntegerField()

    # pr is the paying round: this is randomly chosen
    # in the Results class in Pages.py
    def set_payoffs(self, pr):
        # gets money kept in paying round
        kept = self.in_round(pr).money_kept
        donated = self.in_round(pr).money_donated
        rebate = Constants.round_data[self.participant.id_in_session - 1][pr -
                                                                          1][1]

        # multiplies money kept by rebate to get total payoff
        self.payoff = kept + (donated * (rebate - 1))
Example #5
0
class Player(BasePlayer):

    birthdate = models.StringField(
        label='¿Cuál es su edad? Por favor, use el formato años-meses (por ejemplo, 20-4).',
        widget=widgets.TextInput())

    gender = models.StringField(
        choices=['Masculino', 'Femenino', 'Otro'],
        label='¿Con que género se identifica?',
        widget=widgets.RadioSelect())

    ethnicity = models.StringField(
        choices=['Afro-Ecuatoriana', 'Mestiza', 'Asiatica', 'Indígena', 'Blanca', 'Prefiero no decir'],
        label='¿Con que etnia se identifica?',
        widget=widgets.RadioSelect())

    other_langs = models.StringField(
        label='¿Qué idiomas habla bien?',
        widget=widgets.TextInput())

    langs_used_weekly = models.StringField(
        label='¿Qué idiomas (incluyendo sus idiomas maternos y el Castellano) usa al menos una vez a la semana?',
        widget=widgets.TextInput())

    nationality = models.StringField(
        label='¿Cuál es su nacionalidad?',
        widget=widgets.TextInput())

    birthplace = models.StringField(
        label='¿Donde nació usted? (Ciudad, Provincia/Estado, País)',
        widget=widgets.TextInput())

    residence = models.StringField(
        label='¿En qué país reside?',
        widget=widgets.TextInput())

    bool_student = models.StringField(
        choices=['Sí','No'],
        label='¿Es usted estudiante?',
        widget=widgets.RadioSelect())

    profession = models.StringField(
        label='Si usted no es estudiante, ¿cuál es su profesión? Si es estudiante, escriba \'NA\' en la caja',
        widget=widgets.TextInput())

    education_level = models.StringField(
        choices=['Ninguno','Educación Inicial (Jardín)','Educación General Básica (Primaria)','Bachillerato (Secundaria)',
        'Algo de estudios universitarios (actualmente o pasado)','Instituto Técnico','Licenciatura o equivalente',
        'Maestría o equivalente','Doctorado'],
        label='¿Cuál es su nivel educativo?',
        widget=widgets.RadioSelect())

    phil_course_count = models.StringField(
        choices=['Nunca he tomado un curso de Economía',
                 'He tomado 1 o 2 cursos de Economía',
                 'He tomado más de 2 cursos de Economía, pero la Economía no es la disciplina en la que fui formado.',
                 'Estudio Economía y estoy por obtener una licenciatura en Economía.',
                 'Estudio Economía y tengo una licenciatura en Economía.',
                 'Estoy estudiando un posgrado en Economía.',
                 'Tengo un doctorado en Economía'],
        label='¿Cuántos cursos de Economía recibió durante sus estudios?',
        widget=widgets.RadioSelect())

    parents_income_level = models.StringField(
        choices=['400 o menos','401 a 800','801 a 1200','1201 a 1600',
        '1601 a 2000','2001 o más'],
        label='Hasta donde sabe, ¿cuál es el nivel de ingreso mensual conjunto de sus padres (en dólares)?',
        widget=widgets.RadioSelect())

    parents_edu_level = models.StringField(
        choices=['Ninguno','Educación Inicial (Jardín)','Educación General Básica (Primaria)','Bachillerato (Secundaria)',
        'Algunos estudios universitarios','Instituto Técnico','Licenciatura o equivalente',
        'Maestría o equivalente','Doctorado'],
        label='Hasta donde sabe, ¿cuál es el nivel educativo más alto que alcanzó alguno de sus padres (el que tenga más estudios)?',
        widget=widgets.RadioSelect())

    religion = models.StringField(
        choices=['Ninguna','Católica','Evangelista','Protestante (distinto de evangelista)',
                 'Mormona','Cristiana ortodoxa','Cristiana (otra)','Judía','Musulmana',
                 'Hinduísta','Budista','Sintoísta','Confucionista','Daoista','Jainista',
                 'Sikh','Atea o agnóstica','Otra'],
        label='¿Cuál es su afiliación religiosa actual? ',
        widget=widgets.RadioSelect())

    politics = models.StringField(
        choices=['Muy de izquierda','Izquierda','Centro-izquierda','Centro','Centro-derecha','Derecha','Muy de derecha'],
        label='En términos generales, ¿cuál es su inclinación política?',
        widget=widgets.RadioSelect())

    civil_status = models.StringField(
        choices=['Soltero','Casado','Divorciado','Viudo','Prefiero no decir'],
        label='¿Cuál es su estado civil?',
        widget=widgets.RadioSelect())