def play_round(self): choice_list_human = ["Peace"] * 1 + ["War"] * 1 choice_list_HAI = ["Peace"] * 1 + ["War"] * 1 choice_list_AI = ["Peace"] * 1 + [ "War" ] * 2 #make WAR twice as likely against an AI print('pw bot self.player.play_now: ') print(self.play_now()) if ((self.round_number <= 1) and (self.participant.vars['consent']) and self.play_now()): yield (pages.Introduction) if ((self.round_number <= 1) and (self.participant.vars['consent']) and self.play_now() and self.participant.vars['show_PW_practice']): yield (pages.Practice) if ((self.round_number <= 1) and (self.participant.vars['consent']) and self.play_now()): yield Submission(pages.WaitForPlayers, {}, check_html=False) if ((self.round_number <= self.session.config['num_PW_rounds']) and (self.participant.vars['consent']) and self.play_now()): yield Submission( pages.Decision, { 'decision_vs_adv_1': random.choice(choice_list_human), 'decision_vs_adv_2': random.choice(choice_list_HAI), 'decision_vs_adv_3': random.choice(choice_list_AI) }, check_html=False) if ((self.round_number == self.session.config['num_PW_rounds']) and (self.participant.vars['consent']) and self.play_now()): yield Submission(pages.Results, check_html=False)
def play_round(self): if self.participant.vars["ref"] == "other": if self.round_number == 4: yield (pages.group) if self.round_number == 4: yield Submission(pages.motbel, dict(mot1=random.randrange(0, 50, 1), mot2=random.randrange(0, 50, 1), mot3=random.randrange(0, 50, 1), mot4=random.randrange(0, 50, 1), mot5=random.randrange(0, 50, 1)), check_html=False) yield Submission(pages.perbel, dict(belper=random.randrange(0, 100, 1)), check_html=False) yield (pages.pre1) yield Submission(pages.choice1, dict(dec11=random.randrange(0, 51, 1), dec21=random.randrange(0, 51, 1), dec31=random.randrange(0, 51, 1), dec41=random.randrange(0, 51, 1), dec51=random.randrange(0, 51, 1)), check_html=False) yield Submission(pages.pred1, dict(ass11=random.randrange(0, 51, 1), ass21=random.randrange(0, 51, 1), ass31=random.randrange(0, 51, 1), ass41=random.randrange(0, 51, 1), ass51=random.randrange(0, 51, 1)), check_html=False) yield (pages.Paysplit, dict(ptoday1=random.choice([5.25, 0]), ptoday2=random.choice([5.25, 0]), ptoday3=random.choice([5.25, 0]), ptoday4=random.choice([5.25, 0]), ptoday5=random.choice([5.25, 0]), ptoday6=random.choice([5.25, 0]), ptoday7=random.choice([5.25, 0]), ptoday8=random.choice([5.25, 0]), ptoday9=random.choice([5.25, 0]), ptoday10=random.choice([5.25, 0]), ptoday11=random.choice([5.25, 0]))) if self.round_number == 4: if self.participant.vars['time'] == 'immi': yield (pages.A_Start) if self.participant.vars['time'] == 'immi': if self.round_number > 3: if self.participant.vars['expiry'] - time.time() >= 1: yield Submission(pages.B_Effort, dict(answer=self.subsession.solution), check_html=False) if self.participant.vars['time'] == 'immi': if self.participant.vars['expiry'] - time.time() <= 1: if self.round_number == self.participant.vars["rn"]: yield (pages.Results) elif self.round_number == 44: if self.round_number == self.participant.vars["rn"]: yield (pages.Results)
def play_round(self): if self.round_number == 1: yield (views.Intro) else: if self.group.in_round(self.round_number - 1).dropout_exists: return contribution = random.randint(0, Constants.endowment) if self.group.dropout_exists: yield (views.DropOutFinal) else: if (self.participant.vars['debug_dropout'] and self.round_number == self.participant.vars['debug_when_dropout']): yield Submission(views.Contribute, {'contribution': contribution}, timeout_happened=True) self.player.refresh_from_db() self.group.refresh_from_db() self.participant.refresh_from_db() else: yield Submission(views.Contribute, {'contribution': contribution}) yield (views.Results) if self.round_number == Constants.num_rounds: yield (views.FinalResults) self.player.refresh_from_db() self.group.refresh_from_db() self.participant.refresh_from_db()
def play_round(self): if self.player.role() == 'buyer': offers_input = None offers_properties = None else: assert self.player.role( ) == 'seller', 'player role is something other than buyer or seller' offers_input, offers_properties = self._create_offers_input() # disable HTML checking because formset forms are created dynamically with JavaScript yield Submission(pages.CreateOffersPage, offers_input, check_html=False) self._check_offers(offers_properties) if self.player.role() == 'buyer': purchases_input, purchases_properties = self._create_purchases_input( ) else: purchases_input = None purchases_properties = None yield Submission(pages.PurchasePage, purchases_input, check_html=False) self._check_purchases(purchases_properties) yield Submission(pages.Results) self._check_balance(offers_properties, purchases_properties)
def play_round(self): if self.round_number == 1: yield Submission(pages.initializer_page, check_html=False) yield Submission(pages.tutorial_page, {'transaction': 1}, check_html=False) yield Submission(pages.trading_page, {'transaction': 0}, check_html=False) yield Submission(pages.belief_page, {'belief': 5}, check_html=False) yield (pages.updating_page) if self.round_number == Constants.num_rounds: yield Submission(pages.quiz_page, { 'Q1': '...gleich gross wie die Wahrscheinlichkeit, dass er um 5 sinkt.', 'Q2': '...wahrscheinlicher im schlechten als im guten Zustand.', 'Q3': '...ist es wahrscheinlicher, dass sie im guten Zustand bleibt.', 'Q4': 'Ich gehe automatisch die Wette ein und erhalte die Bonuspunkte falls ' + 'der Preis nun ansteigt.', 'Q5': 'Wenn ich mir relativ sicher bin, dass der Preis der Aktie steigen wird.', 'Q6': '2010', 'wrong_answers': 2 }, check_html=False) yield (pages.end_page)
def play_round(self): if self.group.round_number == 1: yield(views.Consent, {'consent_name': 'test', 'consent_date': '05/31/2017'}) yield (views.Introduction) if self.player.participant.vars['type'] == 'proposer': if self.player.round_number == 1: yield (views.OfferR1, {'amount_offered': c(random.randrange(0, 100, 5)), 'pMAO': c(random.randrange(0, 100, 5))}) else: yield (views.Offer, {'amount_offered': c(random.randrange(0, 100, 5))}) yield Submission(views.FakeWaitPageProposer, check_html=False) else: if self.player.round_number == 2: yield (views.AcceptStrategyR1, {'min_accepted': c(random.randrange(0, 100, 5))}) yield Submission(views.FakeWaitPageResponder, check_html=False) elif self.player.round_number >= 3: yield (views.AcceptStrategy, {'min_accepted': c(random.randrange(0, 100, 5)), 'responder_offered': c(random.randrange(0, 100, 5))}) yield Submission(views.FakeWaitPageResponder, check_html=False) if self.player.round_number == 8: yield (views.Survey, {'q_gender': 'Male', 'q_age': '20', 'q_education': 'High school', 'q_income': 50000, 'q_gamble': '50% chance of winning $10 and 50% chance of winning $10', 'q_fair': 'Compared to other people, I\'m much more intolerant to being unfairly treated.', 'q_risk': 'I\'m much more risk loving than other people'}) yield (views.ResultsFinal)
def play_round(self): if self.subsession.round_number == 1: yield (views.Introduction, {'question_1': 1, 'question_2': 2}) if self.player.id_in_group == 1: if self.subsession.round_number >= self.session.vars[ 'feedback_pol_only'] and (self.group.treatment == 'agenda' or self.group.treatment == 'specific'): yield (views.Polit, { 'allocation_pol': 50, 'specific_given': 2 }) if self.subsession.round_number >= self.session.vars[ 'feedback_pol_only'] and self.group.treatment == 'nominal': yield (views.Polit, {'allocation_pol': 50, 'nominal_given': 2}) if self.subsession.round_number == self.session.vars[ 'paying_round'] and (self.group.treatment == 'agenda' or self.group.treatment == 'specific'): yield (views.Polit, { 'allocation_pol': 50, 'specific_given': 2 }) yield Submission(views.ResultsSummary, check_html=False) if self.subsession.round_number == self.session.vars[ 'paying_round'] and self.group.treatment == 'nominal': yield (views.Polit, { 'allocation_pol': 50, 'specific_given': 2 }) yield Submission(views.ResultsSummary, check_html=False) else: yield (views.Polit, {'allocation_pol': 50}) if self.player.id_in_group == 2: if self.subsession.round_number >= self.session.vars[ 'feedback_pol_only'] and self.group.treatment == 'agenda': yield (views.Bureau, { 'allocation_bureau': 25, 'agenda_feedback': '....' }) if self.subsession.round_number == self.session.vars[ 'paying_round']: yield (views.Bureau, { 'allocation_bureau': 25, 'agenda_feedback': '....' }) yield Submission(views.ResultsSummary, check_html=False) else: yield (views.Bureau, {'allocation_bureau': 25}) if self.player.id_in_group == 3: if self.subsession.round_number == 12 or self.subsession.round_number == 16 or self.subsession.round_number == 20 or self.subsession.round_number == 24: yield (views.Citi_Elect, {'is_elected': 1}) if self.subsession.round_number == 12 or self.subsession.round_number == 16 or self.subsession.round_number == 20 or self.subsession.round_number == 24: yield (views.Citi_Elect, {'is_elected': 1}) yield Submission(views.ResultsSummary, check_html=False) else: yield (views.Citi)
def test_timeout_on_regular_page(self): participant = Participant.objects.get() bot = ParticipantBot(participant, load_player_bots=False) bot.open_start_url() bot.submit(Submission(views.Page1, {}, timeout_happened=True)) # it should be OK to use timeout_happened=True, even if the page # has no timeout_seconds, because you can be simulating "advance slowest" bot.submit(Submission(views.PageWithoutTimeout, {}, timeout_happened=True))
def play_round(self): bi = [True, False] proper_city = random.choice(['01', '02']) yield Submission(pages.Code, {'city': proper_city}, timeout_happened=False) yield Submission(pages.Welcome, {'pc_id': self.player.id_in_subsession}, timeout_happened=False)
def play_round(self): if self.round_number == 1: yield (pages.pre) yield (pages.Anleitung) yield (pages.treatment_pres) if self.round_number == self.participant.vars['task_rounds']['A']: yield (pages.b) if self.round_number == self.participant.vars['task_rounds']['B']: yield (pages.n) if self.round_number == self.participant.vars['task_rounds']['C']: yield (pages.m) if self.round_number == self.participant.vars['task_rounds']['D']: yield (pages.p) if self.round_number == 4: yield Submission(pages.control, dict(Q1_1=3,Q1_2=4,Q1_3=1,Q1_4=2,Q2=2,Q3=3,Q4=1,Q5=4,Q6=1,Q7=2,Q8=1,wrong=1),check_html=False) if self.participant.vars["ref"] == "other": if self.round_number == 4: yield (pages.grouping) if self.round_number == 4: yield Submission(pages.ranking, dict(first="Version A",second="Version B",third="Version C",fourth="Version D"),check_html=False) yield Submission(pages.choi_2, dict(first1="Version A",first2="Version A",first3="Version A",first4="Version A",first5="Version B",first6="Version B",first7="Version B",first8="Version B",first9="Version B",first10="Version B"),check_html=False) yield Submission(pages.choi_3,dict(second1="Version A",second2="Version A",second3="Version A",second4="Version A",second5="Version A",second6="Version C",second7="Version C",second8="Version C",second9="Version C",second10="Version C"),check_html=False) yield Submission(pages.choi_4,dict(third1="Version A",third2="Version A",third3="Version A",third4="Version A",third5="Version A",third6="Version A",third7="Version A",third8="Version D",third9="Version D",third10="Version D"),check_html=False) if self.participant.vars["ref"]=="other": if self.round_number == 4: yield Submission(pages.ranking2, dict(fir2="Version A",sec2="Version B",thi2="Version C",fou2="Version D"),check_html=False) yield Submission(pages.choi_22, dict(first21="Version A",first22="Version A",first23="Version A",first24="Version A",first25="Version B",first26="Version B",first27="Version B",first28="Version B",first29="Version B",first210="Version B"),check_html=False) yield Submission(pages.choi_23,dict(second21="Version A",second22="Version A",second23="Version A",second24="Version A",second25="Version A",second26="Version C",second27="Version C",second28="Version C",second29="Version C",second210="Version C"),check_html=False) yield Submission(pages.choi_24,dict(third21="Version A",third22="Version A",third23="Version A",third24="Version A",third25="Version A",third26="Version A",third27="Version A",third28="Version D",third29="Version D",third210="Version D"),check_html=False)
def play_round(self): yield ExplainingDecodingTask, for i in range(random.randint(1, 5)): self.call_method(Practice) yield Submission(Practice, check_html=False) yield PracticeRETFeedback yield RETIntro for i in range(random.randint(5, 15)): self.call_method(RET) yield Submission(RET, check_html=False) yield PerformanceRETFeedback
def play_round(self): if self.player.round_number == 1: yield (pages.WelcomePage) if self.player.id_in_group == 1: yield (pages.SellerReward) yield Submission(pages.SellerSendBack, { 'quality_amount': random.randint(0, self.group.invest_amount) }, timeout_happened=True) else: yield Submission(pages.BuyerSend, {'invest_amount': Constants.endowment}, timeout_happened=True) yield Submission(pages.BuyerFeedback, { 'feedback_choice': random.choice([False, True]), 'feedback_amount': random.randint(1, 7) }, timeout_happened=True) yield Submission(pages.ResultsSend, timeout_happened=True) if self.player.id_in_group == 1: if self.group.invest_amount == 0: p1_expected_payoff = Constants.endowment elif self.group.feedback_choice == False: p1_expected_payoff = Constants.endowment + self.group.invest_amount - self.group.quality_amount else: p1_expected_payoff = Constants.endowment + self.group.invest_amount - self.group.quality_amount - self.group.reward_amount assert self.player.payoff == p1_expected_payoff if self.group.feedback_choice == True: p1_expected_reputation = self.group.feedback_amount else: p1_expected_reputation = 0 assert self.player.current_reputation == p1_expected_reputation else: if self.group.invest_amount == 0: p2_expected_payoff = Constants.endowment elif self.group.feedback_choice == False: p2_expected_payoff = Constants.endowment - self.group.invest_amount + self.group.quality_amount * Constants.multiplier else: p2_expected_payoff = Constants.endowment - self.group.invest_amount + self.group.quality_amount * Constants.multiplier - self.subsession.feedback_cost( ) + self.group.reward_amount assert self.player.payoff == p2_expected_payoff if self.group.feedback_choice == True: p2_expected_reputation = self.group.feedback_amount else: p2_expected_reputation = 0 assert self.player.current_reputation == p2_expected_reputation
def test_bots_submission_varieties(self): '''Testing different syntaxes for a submission''' Page1 = tests.bots_cases.views.Page1 for submission in [ Submission(Page1), Submission(Page1, {}), SubmissionMustFail(Page1, check_html=False), Submission(Page1, {'f2': True}, check_html=False), SubmissionMustFail(Page1, {}), Submission(Page1, {'f3': True}), ]: self.assertIsInstance(submission, dict)
def play_round(self): yield Consent, yield Instructions, yield Instructions1, self.call_method(Practice) yield Submission(Practice, check_html=False) yield FirstStageAnnouncement, self.call_method(Task1) yield Submission(Task1, check_html=False) yield SecondStageAnnouncement, yield Instructions2, self.call_method(Task2) yield Submission(Task2, check_html=False) yield AfterSecondStage, yield AcuteStress, {'acute1': random.choice(list(range(0, 11)))} yield AcuteStress1, {'acute2': random.choice(list(range(0, 11)))} choices = Constants.CHRONIC_CHOICES chronics = ChronicStress.form_fields answer = {k: random.choice(choices)[0] for k in chronics} yield ChronicStress, answer correct_answers = Constants.qs.copy() for k, v in correct_answers.items(): j = self.player._meta.get_field(k) choices = j.choices if choices: choice = random.choice(choices)[0] r = random.random() if r < 0.5: if choices: correct_answers[k] = choice else: correct_answers[k] = 'aaaaa' else: correct_answers[k] = correct_answers[k]['correct_answer'] yield IntellAbility, correct_answers yield IntellAbilityResults, fields = ['age', 'gender', 'education', 'education1', 'education_other', 'occupation', 'birth', 'game', 'money'] answer = {} for f in fields: j = self.player._meta.get_field(f) choices = j.choices if choices: choice = random.choice(choices)[0] else: choice = 'asdf' answer[f] = choice answer['age'] = random.randint(18, 100) yield SocialEconomic, answer yield Opinion, {'opinion1':'asdf'}
def play_round(self): advisor_choices = ['human'] + ['AI'] + [ 'none' ] #make human choice twice as likely as the other two advisor_choices_weighted = ['human'] + ['AI'] * 2 + ['none'] decision_choices = ['Rock', 'Paper', 'Scissors'] if introduction_check(self): yield (pages.Introduction) if (((self.round_number <= 1) or (self.round_number == (self.session.config['num_RPS_rounds'] + 1)) or (self.round_number == ( (self.session.config['num_RPS_rounds'] * 2) + 1))) and (self.participant.vars['consent']) and self.participant.vars['show_RPS_practice']): yield Submission( pages.Practice, { 'decision_vs_adv_1': random.choice(decision_choices), 'decision_of_adv_1': random.choice(decision_choices), 'advisor_choice': random.choice(advisor_choices_weighted) }, check_html=False) if (((self.round_number <= 1) or (self.round_number == (self.session.config['num_RPS_rounds'] + 1)) or (self.round_number == ( (self.session.config['num_RPS_rounds'] * 2) + 1))) and (self.participant.vars['consent'])): yield Submission(pages.WaitForPlayers, check_html=False) if ((self.round_number <= (self.session.config['num_RPS_rounds'] * 3)) and (self.participant.vars['consent'])): if (self.player.adv_1_type == "AI"): yield Submission( pages.Decision, { 'decision_vs_adv_1': random.choice(decision_choices), 'decision_of_adv_1': random.choice(decision_choices), 'advisor_choice': random.choice(advisor_choices_weighted) }, check_html=False) else: yield Submission( pages.Decision, { 'decision_vs_adv_1': random.choice(decision_choices), 'decision_of_adv_1': random.choice(decision_choices), 'advisor_choice': random.choice(advisor_choices) }, check_html=False) if ((self.round_number == ((self.session.config['num_RPS_rounds'] * 3) + 1)) and (self.participant.vars['consent'])): yield (pages.Results)
def play_round(self): if self.round_number == 1: yield pages.Intro yield pages.Questionnaire1, dict(gender=str(*random.sample([0, 1], 1)), hroot_id="I am a bot, Beep boop."), yield pages.Instructions1 yield Submission(pages.TaskStage, dict(point_score=str(int(numpy.random.normal(100, 15)))), check_html=False) if self.round_number == 1: yield pages.Instructions2 if self.round_number > 1 and self.round_number != Constants.num_rounds: yield Submission(pages.Results, check_html=False)
def play_round(self): yield Submission(pages.Instructions, check_html=False) yield SubmissionMustFail( pages.Comprehension, { 'comp1a': 2, 'comp1b': 2, 'comp1c': 2, 'comp2a': 2, 'comp2b': 2, 'comp2c': 2, 'comp3': False }) yield (pages.Comprehension, Constants.comp_answers) yield (pages.Choice, {'option': random.choice([1, 2])}) yield Submission(pages.Summary, check_html=False)
def play_round(self): if self.player.round_number == 1: yield views.Introduction if self.player.round_number <= self.group.num_rounds(): test_get_payoff() yield Submission(views.Decision, {}, check_html=False) yield views.Results
def play_round(self): print(Fore.BLUE + Back.YELLOW + 'ROUND NUMBER::', self.round_number) if self.round_number == 1: yield Intro if self.round_number == self.session.config['punishment_round']: yield IntroPunishment, contribution = random.randint(0, self.player.endowment) yield Submission(Contribute, {'contribution': contribution}, timeout_happened=False) if self.subsession.punishment: pun_fields = [ 'pun{}'.format(p.id_in_group) for p in self.player.get_others_in_group() ] _sum = self.player.punishment_endowment answers = dict( zip(pun_fields, [random.randint(0, 2) for _ in pun_fields])) yield Punishment, {**answers} yield Results if self.round_number == Constants.num_rounds: yield FinalResults,
def play_round(self): if self.round_number == 1: yield Submission(pages.Introduction, dict(notime=1), check_html=False) yield (pages.Intro_vers) yield (pages.Anleitung)
def play_round(self): yield ( pages.QuestionnairePage, { 'age': random.randint(0, 100), 'gender': random.randint(1, 3), 'sibling_number': random.randint(0, 5), 'program': 'N/A', 'graduate_or_undergraduate': random.choice( ('Bachelor', 'Master')), 'year_of_program': random.randint(0, 10), # 'previous_experiments': 'Nein', 'importance_of_religion': random.randint(0, 10), 'nationality': random.choice(('Deutsch', 'Nicht-Deutsch')), # 'volunteer_work': 'Nein', 'helpfulness_of_communication': random.randint(0, 10), 'attachment_level': random.randint(0, 10), 'ease_of_instruction': random.randint(0, 10), 'familiarity_with_klee': random.randint(0, 10), 'familiarity_with_kandinsky': random.randint(0, 10), 'group_dynamic_influence': 'hello' }) # 'dictator_strategy_no_risk': 'a) Versuch, Punkte gleichmäßig zwischen beiden aufteilen.', # 'dictator_strategy_risk': 'a) Versuch, Punkte gleichmäßig zwischen beiden aufteilen.'}) yield (pages.Results) yield Submission(pages.FinalPage, check_html=False)
def play_round(self): assert self.player.totalearnings==None if self.subsession.round_number==1: yield(views.Introduction) yield Submission(views.Question, {'seq': ''}, timeout_happened=True, check_html=False) assert self.player.totalearnings==0 yield (views.Results)
def play_round(self): yield Submission(pages.Instructions, check_html=False) for i in range(Constants.num_sp): yield (pages.Main, { 'sp' + str(self.session.vars['s_order'][self.player.sp_count - 1]): 1 })
def play_round(self): yield views.Instruction yield Submission(views.Attente, check_html=False) choix = ['option X', 'option Y'] yield (views.Inconditionnel, dict(choix_inconditionnel=random.choice(choix))) yield views.Section yield Submission(views.Attente, check_html=False) yield (views.Conditionnel, dict(choix_conditionnel=random.choice(choix))) yield views.Results yield views.Type
def play_round(self): if self.player.is_playing(): yield (views.NewYear) yield (views.Growth) yield (views.Shock) yield (views.Request, {'request': True}) if self.player.id_in_group == 1: request_player = 2 elif self.player.id_in_group == 2: request_player = 3 else: request_player = 1 yield (views.RequestPlayer, {'request_player': request_player}) yield (views.RequestAmount, {'request_amount': 5}) amount_sent = random.randint(0, self.participant.vars['herd_size']) recipient = [p.id for p in self.player.sender.all()][0] fulfill_dict = { 'sender-INITIAL_FORMS': (1, 1), 'sender-TOTAL_FORMS': (1, 1), 'sender-0-sender': self.player.pk, 'sender-0-id': recipient, 'sender-0-amount_sent': amount_sent, } yield (views.Fulfill, fulfill_dict) yield (views.AllTransfers) yield (views.EndYear) if self.player.dead: yield (views.Dead) if self.round_number == Constants.num_rounds: yield Submission(views.EndExperiment, check_html=False)
def play_round(self): yield Submission(pages.Instructions, check_html=False) yield (pages.Comprehension1, {'c1a': 0, 'c1b': 0}) yield (pages.Comprehension2, {'c2a': 8, 'c2b': 4}) if self.participant.id_in_session % 2: yield(pages.ParticipantADecision, {'a_decision': 5}) else: yield(pages.ParticipantBDecision, { 'b_decision1': 1, 'b_decision2': 1, 'b_decision3': 1, 'b_decision4': 1, 'b_decision5': 1, 'b_decision6': 1, 'b_decision7': 1, 'b_decision8': 1, 'b_decision9': 1, 'b_decision10': 1, 'b_decision11': 1, }) # if self.participant.id_in_session % 2: # assert self.participant.vars['task_payoffs'][0] == c(Constants.total_points - self.a_decision if self.b_decision[self.a_decision-1] else 0) # else: # assert self.participant.vars['task_payoffs'][0] == c(self.a_decision if self.b_decision[self.a_decision-1] else 0) yield(pages.Outcome)
def play_round(self): if self.subsession.round_number == 1: yield Intro, yield Contribute, dict( contribution=random.randint(0, Constants.endowment)) yield Submission(Punishment, self._cq_data(), check_html=False) yield Results,
def play_round(self): yield Instructions, yield Examples, # yield CQs, Constants.correct_answers yield BeforeTheGame, yield PayTax, yield RoleAnnouncement, if self.player.role() == 'officer': available_choices = self.group.k_declare_choices() yield Submission(KDeclare, dict(k_declare=random.choice(available_choices)), check_html=False) else: if self.session.config.get('treatment') == 'negative': yield CheckIncrease, { 'check_investment': random.choice([0, 5]) } yield Results if self.player.role() == 'citizen': yield KBelief, dict( k_belief=random.choice(self.group.k_belief_choices())) if self.player.role() == 'officer': ianswers = dict(off_pos=rb(), off_neg=rb(), quest=1) else: ianswers = dict(cit_pos=rb(), cit_neg=rb(), quest=1) yield Incentives, ianswers
def play_round(self): # p = self.participant.id_in_session # file_name = "player{0}.html".format(p) # f = open(file_name, 'w') # f.write(self.html) # f.close() yield (pages.ThanksForWaiting) yield (pages.Payoffs) yield SubmissionMustFail( pages.Payment, { 'first_name_cleartext': 'Scott', 'last_name_cleartext': 'Claessens', 'bank_details_cleartext': '000-000-000' }) yield (pages.Payment, { 'first_name_cleartext': 'Scott', 'last_name_cleartext': 'Claessens', 'bank_details_cleartext': '12-1234-1234567-001' }) correct = random.choice([1, 0]) yield (pages.BankAgain, {'correct_details': correct}) if correct == 0: yield (pages.BankWrong) yield (pages.Feedback, { 'feedback': "No feedback", 'understand': random.randint(1, 7) }) yield (pages.Recruitment, {'recruitment': 1}) yield SubmissionMustFail(pages.ReEnterLabel, {'reenterlabel': '0'}) yield (pages.ReEnterLabel, {'reenterlabel': 'AAA11'}) yield SubmissionMustFail(pages.ReEnterLabel2, {'reenterlabel2': '0'}) yield (pages.ReEnterLabel2, {'reenterlabel2': 'AAA11'}) yield Submission(pages.Final, check_html=False)
def play_round(self): if self.player.round_number == 1: yield pages.Part_2 yield pages.Instruction yield Submission(pages.Attente, check_html=False) yield pages.Temp if self.player.round_number == 1: yield pages.Info if self.participant.vars['rolee'] == "Worker": yield (pages.Contribution_W, dict(contribution=random.randint(0, Constants.endowment), prediction_W_autre=random.randint( 0, Constants.endowment), prediction_W_seuil=random.randint(0, 4))) if self.participant.vars['rolee'] == "Supervisor": yield (pages.Contribution_S, dict(seuil=random.choice(0, 5, 10, 15, 20), prediction_S_puni=random.randint(0, 2))) yield pages.Results