Esempio n. 1
0
    def play_round(self):
        print("Round #: {}".format(self.round_number))
        if self.round_number == 1:
            yield (SubmissionMustFail(QuizPartOne, {'q1': ['2'], 'q2': ['1']}))
            yield (SubmissionMustFail(QuizPartOne, {'q1': ['1'], 'q2': ['1']}))

            yield (QuizPartOne, {'q1': ['2'], 'q2': ['2']})
            expect(self.player.q1, "['2']")
            expect(self.player.q2, "['2']")

            yield (SubmissionMustFail(QuizPartTwo, {'q3': ['2'], 'q4': ['1']}))
            yield (QuizPartTwo, {'q3': ['2', '3', '4'], 'q4': ['1', '3']})

            yield (InstructionPage)

        if self.round_number != 1 and (
            (self.round_number - 1) % (Constants.rounds_per_lottery + 1)) == 0:
            yield (NewLotteryReminder)

        if ((self.round_number - 1) % (Constants.rounds_per_lottery + 1)) == 0:
            yield (ValuationPage, {'bid': 0})

        if ((self.round_number - 1) % (Constants.rounds_per_lottery + 1)) == 1:
            yield (NewSignalReminder)

        if ((self.round_number - 1) % (Constants.rounds_per_lottery + 1)) != 0:
            yield (BidPage, {'bid': 0})
            yield (OutcomePage)
Esempio n. 2
0
 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)
Esempio n. 3
0
    def play_round(self):
        if self.round_number == 1:
            yield (pages.InstructionsPage)

            max_value = Participant.get_experiment(
                self.player).phase_three.auction(
                    self.player.round_number).max_value
            yield SubmissionMustFail(pages.BidPage, {'bid': -1})
            yield SubmissionMustFail(pages.BidPage, {'bid': max_value + 1})
            yield SubmissionMustFail(pages.BidPage)

            yield (pages.BidPage, {'bid': 0})
            assert self.player.bid == 0
        else:
            max_value = Participant.get_experiment(
                self.player).phase_three.auction(
                    self.player.round_number).max_value
            r_bid = random.randint(0, max_value)
            yield (pages.BidPage, {'bid': r_bid})
            assert self.player.bid == r_bid, "Entered bid {}, Player bid {}".format(
                r_bid, self.player.bid)

            signal = Participant.get_experiment(
                self.player).phase_three.signal(self.player.round_number)
            bid = Participant.get_experiment(self.player).phase_three.auction(
                self.player.round_number).get_bid(signal)
            assert bid == r_bid, "Entered bid {}, Auction bid {}".format(
                r_bid, bid)
Esempio n. 4
0
    def before_reset_price_hook(self, bot):
        for value1 in INVALID_PRICE_VALUES:
            for value2 in INVALID_PRICE_VALUES:
                for value3 in ("True", "False"):
                    yield SubmissionMustFail(
                        pages.ResetPricePage, {
                            'cartel_agree': value3,
                            'cartel_price': value1,
                            'reset_price': value2,
                        })

        for value1 in VALID_PRICE_VALUES:
            for value2 in INVALID_PRICE_VALUES:
                for value3 in ("True", "False"):
                    yield SubmissionMustFail(
                        pages.ResetPricePage, {
                            'cartel_agree': value3,
                            'cartel_price': value1,
                            'reset_price': value2,
                        })

        for value1 in INVALID_PRICE_VALUES:
            for value2 in VALID_PRICE_VALUES:
                for value3 in ("True", "False"):
                    yield SubmissionMustFail(
                        pages.ResetPricePage, {
                            'cartel_agree': value3,
                            'cartel_price': value1,
                            'reset_price': value2,
                        })
    def play_round(self):
        if self.round_number == 1:
            yield (pages.InstructionsPage)

            max_value = Participant.get_experiment(
                self.player).phase_two.get_auction(
                    self.player.round_number).max_value
            yield SubmissionMustFail(pages.CutoffSelectionPage, {
                'cutoff': -1,
                'clicked': 1
            })
            yield SubmissionMustFail(pages.CutoffSelectionPage, {
                'cutoff': max_value + 1,
                'clicked': 1
            })

            yield (pages.CutoffSelectionPage, {'cutoff': 0, 'clicked': 1})
            assert self.player.cutoff == 0
        else:
            max_value = Participant.get_experiment(
                self.player).phase_two.get_auction(
                    self.player.round_number).max_value
            r_cutoff = random.randint(0, max_value)
            yield (pages.CutoffSelectionPage, {
                'cutoff': r_cutoff,
                'clicked': 1
            })
            assert self.player.cutoff == r_cutoff, "Entered cutoff {}, Player cutoff {}".format(
                r_cutoff, self.player.cutoff)

            cutoff = Participant.get_experiment(
                self.player).phase_two.get_auction(
                    self.player.round_number).cutoff
            assert cutoff == r_cutoff, "Entered cutoff {}, Auction cutoff {}".format(
                r_cutoff, cutoff)
Esempio n. 6
0
 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)
Esempio n. 7
0
    def play_round(self):

        # check role assignment
        if self.player.id_in_group == 1:
            assert self.player.role() == 'proposer'

        if self.player.id_in_group == 2:
            assert self.player.role() == 'responder'

        # page 1
        yield (views.RoleAssignment)

        # page 2
        if self.player.role() == 'proposer':
            # proposer page
            yield SubmissionMustFail(views.Proposal,
                                     {'proposer_share': -5})  # negative
            yield SubmissionMustFail(
                views.Proposal, {'proposer_share': 120})  # larger than pot

            yield (views.Proposal, {'proposer_share': 60})

            assert self.group.proposer_share == c(60)

        # page 3
        responder_decision = {'accept': True, 'reject': False}
        payoffs = {
            'proposer': {
                'accept': 60,
                'reject': 0
            },
            'responder': {
                'accept': 40,
                'reject': 0
            }
        }

        if self.player.role() == 'responder':
            yield (views.Response, {'accepted': responder_decision[self.case]})
            if self.case == 'accept':
                assert self.group.accepted == True
            else:
                assert self.group.accepted == False

        # check if payoffs are correctly set:
        assert self.player.payoff == payoffs[self.player.role()][self.case]

        # page 4
        yield (views.Results)
Esempio n. 8
0
    def play_round(self):
        with open('dictator/test_cases.json', 'r',
                  encoding='utf-8') as json_file:
            values = simplejson.load(json_file)
        valid_values = values['values_validation']

        yield views.Introduction

        #Valores fuera del rango [0,100], palabras o caracteres no deberían ser considerados:
        for value in valid_values['valid_kept']:
            yield SubmissionMustFail(views.Offer, {"kept": value})

        yield views.Offer, dict(kept=55)

        yield views.Results

        #Corroborando pagos
        if self.player.dictator == True:
            assert self.player.payoff == self.group.group_kept, "dictator: el pago no es el correcto"

            print(f'Todo salio bien para jugador {self.player.id_in_group}')
        else:
            assert self.player.payoff == Constants.endowment - self.group.group_kept, "citizen: el pago no es el correcto"

            print(f'Todo salio bien para jugador {self.player.id_in_group}')

        print(self.player.payoff, self.group.group_kept, 'Es dictator:',
              self.player.dictator == True)
Esempio n. 9
0
class PlayerBot(Bot):
    cases = [
        {'offer': cu(0), 'return': cu(0), 'p1_payoff': cu(10), 'p2_payoff': cu(0)},
        {'offer': cu(5), 'return': cu(10), 'p1_payoff': cu(15), 'p2_payoff': cu(5)},
        {'offer': cu(10), 'return': cu(30), 'p1_payoff': cu(30), 'p2_payoff': cu(0)},
    ]

    def play_round(self):
        case = self.case
        if self.player.id_in_group == 1:
            yield Send, dict(sent_amount=case['offer'])

        else:
            for invalid_return in [-1, case['offer'] * Constants.multiplier + 1]:
                yield SubmissionMustFail(
                    SendBack, dict(sent_back_amount=invalid_return)
                )
            yield SendBack, dict(sent_back_amount=case['return'])

        if self.player.id_in_group == 1:
            expected_payoff = case['p1_payoff']
        else:
            expected_payoff = case['p2_payoff']

        expect(self.player.payoff, expected_payoff)
Esempio n. 10
0
class PlayerBot(Bot):
    cases = [
        {'offer': c(0), 'return': c(0), 'p1_payoff': c(10), 'p2_payoff': c(0)},
        {'offer': c(5), 'return': c(10), 'p1_payoff': c(15), 'p2_payoff': c(5)},
        {'offer': c(10), 'return': c(30), 'p1_payoff': c(30), 'p2_payoff': c(0)},
    ]

    def play_round(self):
        case = self.case
        if self.player.id_in_group == 1:
            yield (pages.Send, {"sent_amount": case['offer']})

        else:
            for invalid_return in [-1, case['offer'] * Constants.multiplier + 1]:
                yield SubmissionMustFail(
                    pages.SendBack, {'sent_back_amount': invalid_return}
                )
            yield (pages.SendBack, {'sent_back_amount': case['return']})

        if self.player.id_in_group == 1:
            expected_payoff = case['p1_payoff']
        else:
            expected_payoff = case['p2_payoff']

        assert self.player.payoff == expected_payoff
Esempio n. 11
0
    def play_round(self):


        yield (views.Instructions)

        yield (views.Role)

        
        yield (views.DecisionA, {"investment_A":"Project 1"})
        assert self.player.payoff == c(150)
            
        if project_success == "successful":
            assert self.player.payoff == c(150)
        else:
            assert self.player.payoff == c(50)


        yield(views.Information)

        
        if self.player.id_in_group == 3 or self.player.id_in_group == 4:
            yield(views.Punishment, {"punishment":True})
            yield SubmissionMustFail(views.PunishmentDecision, {"punishment_A": 80})
            yield (views.PunishmentDecision, {"punishment_A": 20, "punishment_B": 10, "punishment_C": 5})
        if punishment_selection == "D":
            assert p1.payoff == p1.payoff - 20
            assert p2.payoff == p2.payoff -10
            assert p3.payoff == p3.payoff - 5


        yield (views.Results)

        yield (view.Questions)

        yield (views.Finish)
Esempio n. 12
0
    def play_round(self):

        yield views.Introduction

        # Verificando que valores extremos ni decimales funcionen

        for extreme_value in [-5.5, -100, -1, Constants.endowment + 1, 5.4]:

            yield SubmissionMustFail(views.Contribute,
                                     {'contribution': extreme_value})

        if self.player.id_in_group == 1:
            yield views.Contribute, {"contribution": self.p1}
        elif self.player.id_in_group == 2:
            yield views.Contribute, {"contribution": self.p2}
        elif self.player.id_in_group == 3:
            yield views.Contribute, {"contribution": self.p3}
        else:
            yield views.Contribute, {"contribution": self.p4}

        # Corroborando que los pagos sean los correctos
        pago = (Constants.endowment -
                self.player.contribution) + self.group.individual_share

        yield views.Results

        print(self.player.round_payoff, pago)

        assert self.player.round_payoff == pago, "El pago no cuadra"

        print(f'Todo salio bien para jugador {self.player.id_in_group}')
Esempio n. 13
0
    def play_round(self):
        if self.subsession.round_number == 1:
            yield (pages.Introduction)

        if self.case == 'p1_wins':
            if self.player.id_in_group == 1:
                for invalid_guess in [-1, 101]:
                    yield SubmissionMustFail(pages.Guess,
                                             {"guess": invalid_guess})
                yield (pages.Guess, {"guess": 9})
                assert self.player.payoff == Constants.jackpot
                assert 'you win' in self.html
            else:
                yield (pages.Guess, {"guess": 10})
                assert self.player.payoff == 0
                assert 'you did not win' in self.html
        else:
            if self.player.id_in_group in [1, 2]:
                yield (pages.Guess, {"guess": 9})
                assert self.player.payoff == Constants.jackpot / 2
                assert 'you are one of the 2 winners' in self.html
            else:
                yield (pages.Guess, {"guess": 10})
                assert self.player.payoff == 0
                assert 'you did not win' in self.html

        yield (pages.Results)
Esempio n. 14
0
class PlayerBot(Bot):

    cases = ['basic', 'min', 'max']

    def play_round(self):
        case = self.case
        yield pages.Introduction

        if case == 'basic':
            if self.player.id_in_group == 1:
                for invalid_contribution in [-1, 101]:
                    yield SubmissionMustFail(
                        pages.Contribute,
                        dict(contribution=invalid_contribution))

        contribution = dict(min=0, max=100, basic=50)[case]

        yield pages.Contribute, dict(contribution=contribution)

        yield pages.Results

        if self.player.id_in_group == 1:

            if case == 'min':
                expected_payoff = 100
            elif case == 'max':
                expected_payoff = 200
            else:
                expected_payoff = 150
            expect(self.player.payoff, expected_payoff)
Esempio n. 15
0
class PlayerBot(Bot):

    cases = ['basic', 'min', 'max']

    def play_round(self):
        case = self.case
        yield (views.Introduction)

        if case == 'basic':
            if self.player.id_in_group == 1:
                for invalid_contribution in [-1, 101]:
                    yield SubmissionMustFail(views.Contribute, {
                        'contribution': invalid_contribution})

        contribution = {
            'min': 0,
            'max': 100,
            'basic': 50,
        }[case]

        yield (views.Contribute, {"contribution": contribution})

        yield (views.Results)

        if self.player.id_in_group == 1:

            if case == 'min':
                expected_payoff = 100
            elif case == 'max':
                expected_payoff = 200
            else:
                expected_payoff = 150
            assert self.player.payoff == expected_payoff
Esempio n. 16
0
    def play_round(self):
        if self.round_number == 1:
            yield pages.Introduction

        if self.case == 'p1_wins':
            if self.player.id_in_group == 1:
                for invalid_guess in [-1, 101]:
                    yield SubmissionMustFail(pages.Guess,
                                             dict(guess=invalid_guess))
                yield pages.Guess, dict(guess=9)
                expect(self.player.payoff, Constants.jackpot)
                expect('you win', 'in', self.html)
            else:
                yield pages.Guess, dict(guess=10)
                expect(self.player.payoff, 0)
                expect('you did not win', 'in', self.html)
        else:
            if self.player.id_in_group in [1, 2]:
                yield pages.Guess, dict(guess=9)
                expect(self.player.payoff, Constants.jackpot / 2)
                expect('you are one of the 2 winners', 'in', self.html)
            else:
                yield pages.Guess, dict(guess=10)
                expect(self.player.payoff, 0)
                expect('you did not win', 'in', self.html)

        yield pages.Results
Esempio n. 17
0
    def play_round(self):
        # must reject transcription that is too inaccurate
        yield SubmissionMustFail(pages.Transcribe, {'transcribed_text': 'foo'})

        transcription = Constants.reference_texts[self.subsession.round_number
                                                  - 1]
        add_char = Constants.allowed_error_rates[self.subsession.round_number -
                                                 1] > 0
        if add_char:
            # add a 1-char error, should still be fine
            transcription += 'a'

        yield (pages.Transcribe, {'transcribed_text': transcription})

        for value in [
                self.player.levenshtein_distance, self.player.transcribed_text,
                self.player.payoff
        ]:
            assert value != None

        if add_char:
            assert self.player.levenshtein_distance == 1
        else:
            assert self.player.levenshtein_distance == 0

        if self.subsession.round_number == Constants.num_rounds:
            # final page should print lengths of all reference texts
            for ref_text in Constants.reference_texts:
                assert str(len(ref_text)) in self.html

            # because of add_char, there should be an error in at least 1 round
            assert any(p.levenshtein_distance > 0
                       for p in self.player.in_all_rounds())
Esempio n. 18
0
 def play_round(self):
     yield SubmissionMustFail(views.MyPage, {'invest': -27})
     yield (views.MyPage, {'invest': 20})
     if self.player.decision == 'win':
         assert self.player.payoff == 120
     else:
         assert self.player.payoff == 80
Esempio n. 19
0
 def play_round(self):
     if self.player.id_in_group == 1:
         yield SubmissionMustFail(views.PasswordPage,
                                  {'password': "******"})
         yield (views.PasswordPage, {'password': "******"})
     else:
         pass
     yield (views.Introduction)
     yield SubmissionMustFail(views.Choice, {
         'wtp_remove': 15,
         'expected_green_balls': 15
     })
     yield (views.Choice, {'wtp_remove': 5, 'expected_green_balls': 5})
     yield (views.Information)
     if self.player.id_in_group == 1:
         yield (views.Input, {
             'no_modification_ball': "green",
             'one_modified_ball': "green",
             'five_modified_balls': "green"
         })
     else:
         pass
     yield (views.Results)
     yield SubmissionMustFail(views.Demographics, {
         'age': -3,
         'gender': "male",
         'risk': 8,
         'country': "AT"
     })
     yield SubmissionMustFail(
         views.Demographics, {
             'age': 55,
             'gender': "male",
             'risk': 4,
             'country': "AT",
             'no_student': True,
             'field_of_study': "spam"
         })
     yield (views.Demographics, {
         'age': 55,
         'gender': "male",
         'risk': 4,
         'country': "AT",
         'no_student': True,
         'field_of_study': ""
     })
Esempio n. 20
0
 def play_round(self):
     strings = STRINGS[settings.LANGUAGE_CODE]
     assert strings.next in self.html
     assert strings.yes in self.html
     assert strings.time_left in self.html
     assert strings.user_defined_string in self.html
     yield SubmissionMustFail(views.Page1)
     assert strings.form_has_errors in self.html
Esempio n. 21
0
    def play_round(self):
        yield (views.Instructions)

        for number in [-1, -10, 200, 300]:
            yield SubmissionMustFail(views.BetOnCoin, {'wager': number})

        yield (views.BetOnCoin, {'wager': 50})

        yield (views.Results)
Esempio n. 22
0
class PlayerBot(Bot):
    cases = ['basic', 'min', 'max']

    def play_round(self):
        case = self.case
        yield (views.Introduction)
        if case == 'basic' and self.player.id_in_group == 1:
            for invalid_contribution in [-1, 101]:
                yield SubmissionMustFail(
                    views.Contribute, {'contribution': invalid_contribution})
Esempio n. 23
0
    def play_round(self):

        yield SubmissionMustFail(views.ErrorMessage, {
            'add100_1': 1,
            'add100_2': 98
        })
        yield (views.ErrorMessage, {'add100_1': 1, 'add100_2': 99})
        yield SubmissionMustFail(views.FieldErrorMessage, {'even_int': 1})
        yield (views.FieldErrorMessage, {'even_int': 2})
        yield SubmissionMustFail(views.DynamicChoices,
                                 {'dynamic_choices': 'c'})
        yield (views.DynamicChoices, {
            'dynamic_choices': random.choice(['a', 'b'])
        })
        yield SubmissionMustFail(views.MinMax, {'min_max': 2})
        yield (views.MinMax, {'min_max': 5})
        yield SubmissionMustFail(views.DynamicMinMax, {'dynamic_min_max': 4})
        yield (views.DynamicMinMax, {'dynamic_min_max': 3})
        yield (views.Blank)
Esempio n. 24
0
    def play_round(self):
        if self.player.round_number == 1:
            yield (pages.InstructionsPage)

            yield SubmissionMustFail(pages.SelectAuctionPage, {'preference': 1000000})
            yield SubmissionMustFail(pages.SelectAuctionPage)
            yield (pages.SelectAuctionPage, {'preference': -1})
            assert self.player.preference == -1
        else:
            auction_ids = [
                Participant.get_experiment(self.player).phase_one.left_auction(self.player.round_number).aid,
                Participant.get_experiment(self.player).phase_one.right_auction(self.player.round_number).aid,
                -1]
            random_auction_id = random.choice(auction_ids)

            yield (pages.SelectAuctionPage, {'preference': random_auction_id})

            assert self.player.preference == random_auction_id, "actual preference was {}".format(self.player.preference)
            auction_id = Participant.get_experiment(self.player).phase_one.get_preference(self.player.round_number)
            assert random_auction_id == auction_id, "expected {}, but received {}".format(random_auction_id, auction_id)
Esempio n. 25
0
    def play_round(self):

        # invalid age data should be rejected
        invalid_age_data = {
            'age': -1,  # age is negative
            'gender': 'male',
            'field_of_studies': 'Economics',
            'height': 2.00,
            'weight': 90.0
        }
        yield SubmissionMustFail(views.Demographics, invalid_age_data)

        # invalid gender inputs should also be rejected
        invalid_gender_data = {
            'age': 25,
            'gender':
            'monkey',  # monkey is not an allowed input for the gender field
            'field_of_studies': 'Economics',
            'height': 2.00,
            'weight': 90.0
        }
        yield SubmissionMustFail(views.Demographics, invalid_gender_data)

        # valid data should pass
        valid_survey_data = {
            'age': 25,
            'gender': 'male',
            'field_of_studies': 'Economics',
            'height': 2.00,
            'weight': 90.0
        }
        yield (views.Demographics, valid_survey_data)

        # bmi should now be calculated for each player
        # formula: BMI = w / h^2
        # in our case: BMI = 90 / 2^2 = 90/4 = 22.5
        assert self.player.bmi == 22.5
        assert self.player.bmi_classification == 'normal'

        # finally we should see the Results page.
        yield (views.BMI_Result)
Esempio n. 26
0
    def play_round(self):
        '''all args should autocomplete'''

        yield SubmissionMustFail(
            views.Page1,
            {'a': 1},
            check_html=True)

        yield Submission(
            views.Page1,
            {'a': 1},
            check_html=False,
            timeout_happened=True)
Esempio n. 27
0
    def play_round(self):
        yield (views.Instructions)

        for test_number in [-1, -2, 4, 0.5]:
            yield SubmissionMustFail(
                views.Demographics, {
                    'age': 25,
                    'field_of_study': "",
                    'female': 0,
                    'height': test_number,
                    'weight': 100,
                    'likes_experiment': "Yes, of course!"
                })
Esempio n. 28
0
    def play_round(self):
        a_revealed = random.choice([True, False])
        a_option = random.choice([1, 2])
        b_option = random.choice([1, 2])
        c_option = random.choice([1, 2])

        yield (pages.AInstructions)
        yield SubmissionMustFail(pages.AComprehension, {
            "a_comp1": 1,
            "a_comp2": 2,
            "a_comp3": 2
        })
        yield (pages.AComprehension, Constants.a_comp_answers)
        if a_revealed:
            yield (pages.AChoice, {'a_revealed': a_revealed})
            yield Submission(pages.ARevealed, {'a_option': a_option})
        else:
            yield (pages.AChoice, {'a_option': a_option})

        yield (pages.BInstructions)
        yield SubmissionMustFail(pages.BComprehension, {
            "b_comp1a": 5,
            "b_comp1b": 3,
            "b_comp2a": 2,
            "b_comp2b": 1
        })
        yield (pages.BComprehension, Constants.b_comp_answers)
        yield (pages.BChoice, {'b_option': b_option})

        yield (pages.CInstructions)
        yield SubmissionMustFail(pages.CComprehension, {
            "c_comp1a": 2,
            "c_comp1b": 7,
            "c_comp2a": 1,
            "c_comp2b": 7
        })
        yield (pages.CComprehension, Constants.c_comp_answers)
        yield (pages.CChoice, {'c_option': c_option})
Esempio n. 29
0
 def play_round(self):
     yield (pages.Introduction)
     yield SubmissionMustFail(pages.Main, {'request': 80})
     if self.case == 'add20':
         if self.player.id_in_group == 1:
             yield (pages.Main, {'request': 11})
             assert self.player.payoff == c(31)
         else:
             yield (pages.Main, {'request': 12})
             assert self.player.payoff == c(12)
     else:
         yield (pages.Main, {'request': 12})
         assert self.player.payoff == c(12)
     yield (pages.Results)
Esempio n. 30
0
 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)