Test_Johanne/dictator_modif_class_v2/tests.py

36 lines
979 B
Python
Raw Permalink Normal View History

2025-03-06 10:28:01 +01:00
from otree.api import Currency as c, currency_range
from . import pages
from ._builtin import Bot
from .models import Constants
import random
class PlayerBot(Bot):
def play_round(self):
if self.participant.vars['app_sequence_select'] % 2 == 0:
if self.round_number == 1:
yield (pages.Bienvenue)
yield (pages.Introduction, {
"r1": 98,
"r2":2,
"r3":5,
"r4":110,
})
yield (pages.NextPage, {})
keep_amount = random.randint(0, self.player.dot1)
sent_amount = self.player.dot1 - keep_amount
yield (pages.Send, {
"keep_amount": keep_amount,
"sent_amount": sent_amount,
})
# if self.round_number == 8:
# yield (pages.Results, {
# })
#if self.player.id_in_group == 1: