# -*- coding: utf-8 -*- from __future__ import division import random from otree.common import Currency as c, currency_range from ._builtin import Bot from .models import Constants from . import views class PlayerBot(Bot): def play_round(self): rounds = Constants.num_rounds round = self.subsession.round_number if round == 1: self.submit(views.Welcome) if self.player.participant.vars['pledge']: self.submit(views.Pledge) self.submit(views.Birthday) if round == 2: self.submit(views.Phone) if round == 3: self.submit(views.Pets) if round == 4: self.submit(views.House) if round == 5: self.submit(views.Age) if round == 6: self.submit(views.Birthyear) if round == 7: self.submit(views.Name) if round == 8: self.submit(views.Time) if round == 9: self.submit(views.Relative) if round == 10: self.submit(views.Name2) if round != rounds: self.submit(views.Answer, {"answer": random.choice([True, False])} ) self.submit(views.Results) # submitted in last round if round == rounds: self.submit(views.Demographics, {'country': 'NL', 'age': 20, 'gender': random.choice(['Male', 'Female']), 'career': 'Student', 'study': 'Study', 'family': 'Single', 'children': 0, 'purpose': 'Purpose', 'payment_method': random.choice([True, False]), 'IBAN': 'IBAN', 'BIC': 'BIC', 'transfer_name': 'own name'}) self.submit(views.SumResults) def validate_play(self): pass