from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Game(Page): timeout_seconds = 50 form_model = 'player' form_fields = ['ansA', 'ansB', 'ansC', 'ansD', 'ansE', 'ansF', 'ansG', 'ansH', 'ansI', 'ansJ', 'ansK', 'ansL', 'ansM', 'ansN', 'ansO', 'ansP', 'ansQ', 'ansR', 'ansS', 'ansT', 'ansU', 'ansV', 'ansW', 'ansX', 'ansY', 'ansZ' ] def vars_for_template(self): return dict( ansA_label = 'Type {}.'.format(self.player.queA), ansB_label = 'Type {}.'.format(self.player.queB), ansC_label = 'Type {}.'.format(self.player.queC), ansD_label = 'Type {}.'.format(self.player.queD), ansE_label = 'Type {}.'.format(self.player.queE), ansF_label = 'Type {}.'.format(self.player.queF), ansG_label = 'Type {}.'.format(self.player.queG), ansH_label = 'Type {}.'.format(self.player.queH), ansI_label = 'Type {}.'.format(self.player.queI), ansJ_label = 'Type {}.'.format(self.player.queJ), ansK_label = 'Type {}.'.format(self.player.queK), ansL_label = 'Type {}.'.format(self.player.queL), ansM_label = 'Type {}.'.format(self.player.queM), ansN_label = 'Type {}.'.format(self.player.queN), ansO_label = 'Type {}.'.format(self.player.queO), ansP_label = 'Type {}.'.format(self.player.queP), ansQ_label = 'Type {}.'.format(self.player.queQ), ansR_label = 'Type {}.'.format(self.player.queR), ansS_label = 'Type {}.'.format(self.player.queS), ansT_label = 'Type {}.'.format(self.player.queT), ansU_label = 'Type {}.'.format(self.player.queU), ansV_label = 'Type {}.'.format(self.player.queV), ansW_label = 'Type {}.'.format(self.player.queW), ansX_label = 'Type {}.'.format(self.player.queX), ansY_label = 'Type {}.'.format(self.player.queY), ansZ_label = 'Type {}.'.format(self.player.queZ), ) class Results(Page): def vars_for_template(self): payoff = 0 if self.player.queA == self.player.ansA: payoff += 5 if self.player.queB == self.player.ansB: payoff += 5 if self.player.queC == self.player.ansC: payoff += 5 if self.player.queD == self.player.ansD: payoff += 5 if self.player.queE == self.player.ansE: payoff += 5 if self.player.queF == self.player.ansF: payoff += 5 if self.player.queG == self.player.ansG: payoff += 5 if self.player.queH == self.player.ansH: payoff += 5 if self.player.queI == self.player.ansI: payoff += 5 if self.player.queJ == self.player.ansJ: payoff += 5 if self.player.queK == self.player.ansK: payoff += 5 if self.player.queL == self.player.ansL: payoff += 5 if self.player.queM == self.player.ansM: payoff += 5 if self.player.queN == self.player.ansN: payoff += 5 if self.player.queO == self.player.ansO: payoff += 5 if self.player.queP == self.player.ansP: payoff += 5 if self.player.queQ == self.player.ansQ: payoff += 5 if self.player.queR == self.player.ansR: payoff += 5 if self.player.queS == self.player.ansS: payoff += 5 if self.player.queT == self.player.ansT: payoff += 5 if self.player.queU == self.player.ansU: payoff += 5 if self.player.queV == self.player.ansV: payoff += 5 if self.player.queW == self.player.ansW: payoff += 5 if self.player.queX == self.player.ansX: payoff += 5 if self.player.queY == self.player.ansY: payoff += 5 if self.player.queZ == self.player.ansZ: payoff += 5 return dict(payoff = payoff) page_sequence =[ Game, Results ]