from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants #from Dqn import * import numpy as np class Instructions(Page): def is_displayed(self): if self.round_number==1: return True else: return False class Introduction(Page): """Description of the game: How to play and returns expected""" def before_next_page(self): self.group.calcStateVariables(self.player) #self.group.updateGameHistory() #print(self.group.learningAgent.gameHistory) class Initial(Page): pass class OrderDecision(Page): """Player: Choose how much to order""" # def vars_for_template(self): # if self.round_number == 1: # myEffectiveInventory= 12 # else: # print(self.player.inventory_level(self.round_number - 1)) # myEffectiveInventory = self.player.inventory_level(self.round_number - 1) # print(myEffectiveInventory) # return{ # # 'inventory_level_begin': str(myEffectiveInventory), # } form_model = 'player' form_fields = ['placed_order'] # def placed_order_max(self): # if self.player.id_in_group==1: # return 25 # elif self.player.id_in_group==2: # return 50 # else: # return 100 class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): # self.group.calcStateVariables() #self.group.updateGameHistory() # print(self.group.learningAgent.gameHistory) #self.group.calcStateVariables() pass body_text = "Waiting for other participants to contribute." class Results(Page): """Players payoff: How much each has earned""" def vars_for_template(self): return { 'total_cost': self.player.currentCost, } page_sequence = [ Instructions, Introduction, OrderDecision, ResultsWaitPage, ##Results ]