import random from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'wfg_v2' # need to change number of players in settings.py PLAYERS_PER_GROUP = None # will have to change treatment info with each NUM_ROUNDS = 8 Prescribed_Burn_Cost = -400 Defensive_Space_Cost = -300 # is what random fire chance is compared against fire_limit = 1 / 2 # will need nine roles is total Forest_1_Owner_ROLE = "subject_1" Forest_2_Owner_ROLE = "subject_2" Forest_3_Owner_ROLE = "subject_3" Forest_4_Owner_ROLE = "subject_4" Forest_5_Owner_ROLE = "subject_5" Forest_6_Owner_ROLE = "subject_6" Forest_7_Owner_ROLE = "subject_7" Forest_8_Owner_ROLE = "subject_8" Forest_9_Owner_ROLE = "subject_9" class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # in game choice management_choice = models.IntegerField( choices=[ [1, 'Prescribed Burn, Cost: $400'], [2, 'Defensible Space, Cost $300'], [3, 'No Action, Cost $0'], ], widget=widgets.RadioSelect ) # game mechanics for fire fire = models.BooleanField() fire_started = models.BooleanField() fire_chance = models.FloatField() # game mechanics for fire spreading UNTESTED !!!! # differentiating between subject choices choice_subject_1 = models.IntegerField() choice_subject_2 = models.IntegerField() choice_subject_3 = models.IntegerField() choice_subject_4 = models.IntegerField() choice_subject_5 = models.IntegerField() choice_subject_6 = models.IntegerField() choice_subject_7 = models.IntegerField() choice_subject_8 = models.IntegerField() choice_subject_9 = models.IntegerField() # tells where fire started fire_start_subject_1 = models.BooleanField() fire_start_subject_2 = models.BooleanField() fire_start_subject_3 = models.BooleanField() fire_start_subject_4 = models.BooleanField() fire_start_subject_5 = models.BooleanField() fire_start_subject_6 = models.BooleanField() fire_start_subject_7 = models.BooleanField() fire_start_subject_8 = models.BooleanField() fire_start_subject_9 = models.BooleanField() # utility gained from forest and home forest_utility = models.IntegerField() home_utility = models.IntegerField() # profit from each round round_profit = models.IntegerField() # after game questions fire_on_actual_property = models.IntegerField( choices=[ [1, "Yes"], [2, 'No'], ], widget=widgets.RadioSelect ) damage_to_actual_home = models.BooleanField( blank=True, widgets=widgets.CheckboxInput ) damage_to_other_physical_structure = models.BooleanField( widgets=widgets.CheckboxInput, blank=True ) damage_to_actual_forest = models.BooleanField( blank=True, widgets=widgets.CheckboxInput ) damage_to_other = models.BooleanField( blank=True, widgets=widgets.CheckboxInput ) other_damage = models.StringField() first_name = models.StringField() last_name = models.StringField() email = models.StringField() # PAGES # Intro is good class IntroductionPage(Page): @staticmethod def is_displayed(player: Player): return player.round_number == 1 class IntroWaitPage(WaitPage): pass class ChoicePage(Page): # player choice is good form_model = "player" form_fields = ["management_choice"] @staticmethod def vars_for_template(player: Player): # gives random number between 0 and 1 to determine fire start player.fire_chance = random.random() # reports which forest each player is managing if player.role == C.Forest_1_Owner_ROLE: forest_owned_report = 'You are managing Forest 1' if player.role == C.Forest_2_Owner_ROLE: forest_owned_report = 'You are managing Forest 2' if player.role == C.Forest_3_Owner_ROLE: forest_owned_report = 'You are managing Forest 3' if player.role == C.Forest_4_Owner_ROLE: forest_owned_report = 'You are managing Forest 4' if player.role == C.Forest_5_Owner_ROLE: forest_owned_report = 'You are managing Forest 5' if player.role == C.Forest_6_Owner_ROLE: forest_owned_report = 'You are managing Forest 6' if player.role == C.Forest_7_Owner_ROLE: forest_owned_report = 'You are managing Forest 7' if player.role == C.Forest_8_Owner_ROLE: forest_owned_report = 'You are managing Forest 8' if player.role == C.Forest_9_Owner_ROLE: forest_owned_report = 'You are managing Forest 9' return { 'player.fire_chance': player.fire_chance, 'forest_owned_report': forest_owned_report } class ResultsWaitPage(WaitPage): pass class Results(Page): @staticmethod def vars_for_template(player: Player): # reports which forest each player is managing if player.role == C.Forest_1_Owner_ROLE: forest_owned_report = 'You are managing Forest 1' if player.role == C.Forest_2_Owner_ROLE: forest_owned_report = 'You are managing Forest 2' if player.role == C.Forest_3_Owner_ROLE: forest_owned_report = 'You are managing Forest 3' if player.role == C.Forest_4_Owner_ROLE: forest_owned_report = 'You are managing Forest 4' if player.role == C.Forest_5_Owner_ROLE: forest_owned_report = 'You are managing Forest 5' if player.role == C.Forest_6_Owner_ROLE: forest_owned_report = 'You are managing Forest 6' if player.role == C.Forest_7_Owner_ROLE: forest_owned_report = 'You are managing Forest 7' if player.role == C.Forest_8_Owner_ROLE: forest_owned_report = 'You are managing Forest 8' if player.role == C.Forest_9_Owner_ROLE: forest_owned_report = 'You are managing Forest 9' # reports player's own choice if player.management_choice == 1: management_choice_report = 'You chose to perform a prescribed burn. The cost was $400.' elif player.management_choice == 2: management_choice_report = 'You chose to maintain a defensive space. The cost was $300.' elif player.management_choice == 3: management_choice_report = 'You chose to do nothing.' # reports if fire stated on player's own property # if change fraction: 1/9 here also need to change it at if statement below if player.fire_chance <= C.fire_limit: player.fire_started = True fire_started_report = "The fire started on your property." else: player.fire_started = False fire_started_report = "A fire did not start on your property." # game mechanics for fire spreading # differentiating between subject choices subject_1 = player.group.get_player_by_role(C.Forest_1_Owner_ROLE) subject_2 = player.group.get_player_by_role(C.Forest_2_Owner_ROLE) subject_3 = player.group.get_player_by_role(C.Forest_3_Owner_ROLE) subject_4 = player.group.get_player_by_role(C.Forest_4_Owner_ROLE) subject_5 = player.group.get_player_by_role(C.Forest_5_Owner_ROLE) subject_6 = player.group.get_player_by_role(C.Forest_6_Owner_ROLE) subject_7 = player.group.get_player_by_role(C.Forest_7_Owner_ROLE) subject_8 = player.group.get_player_by_role(C.Forest_8_Owner_ROLE) subject_9 = player.group.get_player_by_role(C.Forest_9_Owner_ROLE) player.choice_subject_1 = subject_1.management_choice player.choice_subject_2 = subject_2.management_choice player.choice_subject_3 = subject_3.management_choice player.choice_subject_4 = subject_4.management_choice player.choice_subject_5 = subject_5.management_choice player.choice_subject_6 = subject_6.management_choice player.choice_subject_7 = subject_7.management_choice player.choice_subject_8 = subject_8.management_choice player.choice_subject_9 = subject_9.management_choice # reporting subject choices if player.choice_subject_1 == 1: group_choice_report_1 = "Forest 1: Prescribed burn" elif player.choice_subject_1 == 2: group_choice_report_1 = 'Forest 1: Defensive Space' elif player.choice_subject_1 == 3: group_choice_report_1 = 'Forest 1: No Action' if player.choice_subject_2 == 1: group_choice_report_2 = "Forest 2: Prescribed burn" elif player.choice_subject_2 == 2: group_choice_report_2 = 'Forest 2: Defensive Space' elif player.choice_subject_2 == 3: group_choice_report_2 = 'Forest 2: No Action' if player.choice_subject_3 == 1: group_choice_report_3 = "Forest 3: Prescribed burn" elif player.choice_subject_3 == 2: group_choice_report_3 = 'Forest 3: Defensive Space' elif player.choice_subject_3 == 3: group_choice_report_3 = 'Forest 3: No Action' if player.choice_subject_4 == 1: group_choice_report_4 = "Forest 4: Prescribed burn" elif player.choice_subject_4 == 2: group_choice_report_4 = 'Forest 4: Defensive Space' elif player.choice_subject_4 == 3: group_choice_report_4 = 'Forest 4: No Action' if player.choice_subject_5 == 1: group_choice_report_5 = "Forest 5: Prescribed burn" elif player.choice_subject_5 == 2: group_choice_report_5 = 'Forest 5: Defensive Space' elif player.choice_subject_5 == 3: group_choice_report_5 = 'Forest 5: No Action' if player.choice_subject_6 == 1: group_choice_report_6 = "Forest 6: Prescribed burn" elif player.choice_subject_6 == 2: group_choice_report_6 = 'Forest 6: Defensive Space' elif player.choice_subject_6 == 3: group_choice_report_6 = 'Forest 6: No Action' if player.choice_subject_7 == 1: group_choice_report_7 = "Forest 7: Prescribed burn" elif player.choice_subject_7 == 2: group_choice_report_7 = 'Forest 7: Defensive Space' elif player.choice_subject_7 == 3: group_choice_report_7 = 'Forest 7: No Action' if player.choice_subject_8 == 1: group_choice_report_8 = "Forest 8: Prescribed burn" elif player.choice_subject_8 == 2: group_choice_report_8 = 'Forest 8: Defensive Space' elif player.choice_subject_8 == 3: group_choice_report_8 = 'Forest 8: No Action' if player.choice_subject_9 == 1: group_choice_report_9 = "Forest 9: Prescribed burn" elif player.choice_subject_9 == 2: group_choice_report_9 = 'Forest 9: Defensive Space' elif player.choice_subject_9 == 3: group_choice_report_9 = 'Forest 9: No Action' # tells where fire started if subject_1.fire_chance <= C.fire_limit: player.fire_start_subject_1 = True elif subject_1.fire_chance > C.fire_limit: player.fire_start_subject_1 = False if subject_2.fire_chance <= C.fire_limit: player.fire_start_subject_2 = True elif subject_2.fire_chance > C.fire_limit: player.fire_start_subject_2 = False if subject_3.fire_chance <= C.fire_limit: player.fire_start_subject_3 = True elif subject_3.fire_chance > C.fire_limit: player.fire_start_subject_3 = False if subject_4.fire_chance <= C.fire_limit: player.fire_start_subject_4 = True elif subject_4.fire_chance > C.fire_limit: player.fire_start_subject_4 = False if subject_5.fire_chance <= C.fire_limit: player.fire_start_subject_5 = True elif subject_5.fire_chance > C.fire_limit: player.fire_start_subject_5 = False if subject_6.fire_chance <= C.fire_limit: player.fire_start_subject_6 = True elif subject_6.fire_chance > C.fire_limit: player.fire_start_subject_6 = False if subject_7.fire_chance <= C.fire_limit: player.fire_start_subject_7 = True elif subject_7.fire_chance > C.fire_limit: player.fire_start_subject_7 = False if subject_8.fire_chance <= C.fire_limit: player.fire_start_subject_8 = True elif subject_8.fire_chance > C.fire_limit: player.fire_start_subject_8 = False if subject_9.fire_chance <= C.fire_limit: player.fire_start_subject_9 = True elif subject_9.fire_chance > C.fire_limit: player.fire_start_subject_9 = False # reporting where fire started if player.fire_start_subject_1: group_fire_report_1 = 'A fire started in Forest 1' elif not player.fire_start_subject_1: group_fire_report_1 = 'A fire did not start in Forest 1' if player.fire_start_subject_2: group_fire_report_2 = 'A fire started in Forest 2' elif not player.fire_start_subject_2: group_fire_report_2 = 'A fire did not start in Forest 2' if player.fire_start_subject_3: group_fire_report_3 = 'A fire started in Forest 3' elif not player.fire_start_subject_3: group_fire_report_3 = 'A fire did not start in Forest 3' if player.fire_start_subject_4: group_fire_report_4 = 'A fire started in Forest 4' elif not player.fire_start_subject_4: group_fire_report_4 = 'A fire did not start in Forest 4' if player.fire_start_subject_5: group_fire_report_5 = 'A fire started in Forest 5' elif not player.fire_start_subject_5: group_fire_report_5 = 'A fire did not start in Forest 5' if player.fire_start_subject_6: group_fire_report_6 = 'A fire started in Forest 6' elif not player.fire_start_subject_6: group_fire_report_6 = 'A fire did not start in Forest 6' if player.fire_start_subject_7: group_fire_report_7 = 'A fire started in Forest 7' elif not player.fire_start_subject_7: group_fire_report_7 = 'A fire did not start in Forest 7' if player.fire_start_subject_8: group_fire_report_8 = 'A fire started in Forest 8' elif not player.fire_start_subject_8: group_fire_report_8 = 'A fire did not start in Forest 8' if player.fire_start_subject_9: group_fire_report_9 = 'A fire started in Forest 9' elif not player.fire_start_subject_9: group_fire_report_9 = 'A fire did not start in Forest 9' # determining if a fire spread from where it started fire_spread_from_1 = player.fire_start_subject_1 and player.choice_subject_1 != 1 fire_spread_from_2 = player.fire_start_subject_2 and player.choice_subject_2 != 1 fire_spread_from_3 = player.fire_start_subject_3 and player.choice_subject_3 != 1 fire_spread_from_4 = player.fire_start_subject_4 and player.choice_subject_4 != 1 fire_spread_from_5 = player.fire_start_subject_5 and player.choice_subject_5 != 1 fire_spread_from_6 = player.fire_start_subject_6 and player.choice_subject_6 != 1 fire_spread_from_7 = player.fire_start_subject_7 and player.choice_subject_7 != 1 fire_spread_from_8 = player.fire_start_subject_8 and player.choice_subject_8 != 1 fire_spread_from_9 = player.fire_start_subject_9 and player.choice_subject_9 != 1 # testing if spread function works DELETE AFTER USE !!!! if fire_spread_from_1: group_fire_spread_report_1 = 'Fire spread from 1' elif not fire_spread_from_1: group_fire_spread_report_1 = 'Fire did not spread from 1' if fire_spread_from_2: group_fire_spread_report_2 = 'Fire spread from 2' elif not fire_spread_from_2: group_fire_spread_report_2 = 'Fire did not spread from 2' if fire_spread_from_3: group_fire_spread_report_3 = 'Fire spread from 3' elif not fire_spread_from_3: group_fire_spread_report_3 = 'Fire did not spread from 3' if fire_spread_from_4: group_fire_spread_report_4 = 'Fire spread from 4' elif not fire_spread_from_4: group_fire_spread_report_4 = 'Fire did not spread from 4' if fire_spread_from_5: group_fire_spread_report_5 = 'Fire spread from 5' elif not fire_spread_from_5: group_fire_spread_report_5 = 'Fire did not spread from 5' if fire_spread_from_6: group_fire_spread_report_6 = 'Fire spread from 6' elif not fire_spread_from_6: group_fire_spread_report_6 = 'Fire did not spread from 6' if fire_spread_from_7: group_fire_spread_report_7 = 'Fire spread from 7' elif not fire_spread_from_7: group_fire_spread_report_7 = 'Fire did not spread from 7' if fire_spread_from_8: group_fire_spread_report_8 = 'Fire spread from 8' elif not fire_spread_from_8: group_fire_spread_report_8 = 'Fire did not spread from 8' if fire_spread_from_9: group_fire_spread_report_9 = 'Fire spread from 9' elif not fire_spread_from_9: group_fire_spread_report_9 = 'Fire did not spread from 9' # relevant prescribed burn configurations # see WF PB Configs Excel sheet for following configuration references choice_config_1 = (player.choice_subject_2 == 1 and player.choice_subject_5 == 1 and player.choice_subject_8 == 1) choice_config_2 = (player.choice_subject_4 == 1 and player.choice_subject_5 == 1 and player.choice_subject_6 == 1) choice_config_3 = (player.choice_subject_2 == 1 and player.choice_subject_4 == 1) choice_config_4 = (player.choice_subject_2 == 1 and player.choice_subject_6 == 1) choice_config_5 = (player.choice_subject_6 == 1 and player.choice_subject_8 == 1) choice_config_6 = (player.choice_subject_4 == 1 and player.choice_subject_8 == 1) choice_config_7 = (player.choice_subject_1 == 1 and player.choice_subject_5 == 1 and player.choice_subject_7 == 1) choice_config_8 = (player.choice_subject_1 == 1 and player.choice_subject_3 == 1 and player.choice_subject_5 == 1) choice_config_9 = (player.choice_subject_3 == 1 and player.choice_subject_5 == 1 and player.choice_subject_9 == 1) choice_config_10 = (player.choice_subject_5 == 1 and player.choice_subject_7 == 1 and player.choice_subject_9 == 1) choice_config_11 = (player.choice_subject_2 == 1 and player.choice_subject_4 == 1 and player.choice_subject_6 == 1 and player.choice_subject_8 == 1) choice_config_12 = (player.choice_subject_2 == 1 and player.choice_subject_5 == 1 and player.choice_subject_7 == 1) choice_config_13 = (player.choice_subject_2 == 1 and player.choice_subject_5 == 1 and player.choice_subject_9 == 1) choice_config_14 = (player.choice_subject_1 == 1 and player.choice_subject_5 == 1 and player.choice_subject_8 == 1) choice_config_15 = (player.choice_subject_3 == 1 and player.choice_subject_5 == 1 and player.choice_subject_8 == 1) choice_config_16 = (player.choice_subject_3 == 1 and player.choice_subject_4 == 1 and player.choice_subject_5 == 1) choice_config_17 = (player.choice_subject_4 == 1 and player.choice_subject_5 == 1 and player.choice_subject_9 == 1) choice_config_18 = (player.choice_subject_1 == 1 and player.choice_subject_5 == 1 and player.choice_subject_6 == 1) choice_config_19 = (player.choice_subject_5 == 1 and player.choice_subject_6 == 1 and player.choice_subject_7 == 1) choice_config_20 = (player.choice_subject_3 == 1 and player.choice_subject_5 == 1 and player.choice_subject_7 == 1) choice_config_21 = (player.choice_subject_1 == 1 and player.choice_subject_5 == 1 and player.choice_subject_9 == 1) # fire spread combos relevant to configurations fire_combo_none = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_4 and not fire_spread_from_5 and not fire_spread_from_6 and not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_1_1 = (not fire_spread_from_3 and not fire_spread_from_6 and not fire_spread_from_9) fire_combo_1_2 = (not fire_spread_from_1 and not fire_spread_from_4 and not fire_spread_from_7) fire_combo_2_1 = (not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_2_2 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3) fire_combo_3_1 = (not fire_spread_from_3 and not fire_spread_from_5 and not fire_spread_from_6 and not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_4_1 = (not fire_spread_from_1 and not fire_spread_from_4 and not fire_spread_from_5 and not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_5_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_4 and not fire_spread_from_5 and not fire_spread_from_7) fire_combo_6_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_5 and not fire_spread_from_6 and not fire_spread_from_9) fire_combo_7_1 = (not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_6 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_8_1 = (not fire_spread_from_4 and not fire_spread_from_6 and not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_9_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_4 and not fire_spread_from_7 and not fire_spread_from_8) fire_combo_10_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_4 and not fire_spread_from_6) fire_combo_12_1 = (not fire_spread_from_3 and not fire_spread_from_6 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_12_2 = (not fire_spread_from_1 and not fire_spread_from_4) fire_combo_13_1 = (not fire_spread_from_1 and not fire_spread_from_4 and not fire_spread_from_7 and not fire_spread_from_8) fire_combo_13_2 = (not fire_spread_from_3 and not fire_spread_from_6) fire_combo_14_1 = (not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_6 and not fire_spread_from_9) fire_combo_14_2 = (not fire_spread_from_4 and not fire_spread_from_7) fire_combo_15_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_4 and not fire_spread_from_7) fire_combo_15_2 = (not fire_spread_from_6 and not fire_spread_from_9) fire_combo_16_1 = (not fire_spread_from_6 and not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_16_2 = (not fire_spread_from_1 and not fire_spread_from_2) fire_combo_17_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_6) fire_combo_17_2 = (not fire_spread_from_7 and not fire_spread_from_8) fire_combo_18_1 = (not fire_spread_from_4 and not fire_spread_from_7 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_18_2 = (not fire_spread_from_2 and not fire_spread_from_3) fire_combo_19_1 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_4) fire_combo_19_2 = (not fire_spread_from_8 and not fire_spread_from_9) fire_combo_20_1 = (not fire_spread_from_6 and not fire_spread_from_8 and not fire_spread_from_9) fire_combo_20_2 = (not fire_spread_from_1 and not fire_spread_from_2 and not fire_spread_from_4) fire_combo_21_1 = (not fire_spread_from_2 and not fire_spread_from_3 and not fire_spread_from_6) fire_combo_21_2 = (not fire_spread_from_4 and not fire_spread_from_7 and not fire_spread_from_8) # possible outcomes where fire doesn't spread to everyone outcome_none = fire_combo_none outcome_1 = (choice_config_1 and fire_combo_1_1) outcome_2 = (choice_config_1 and fire_combo_1_2) outcome_3 = (choice_config_2 and fire_combo_2_1) outcome_4 = (choice_config_2 and fire_combo_2_2) outcome_5 = (choice_config_3 and fire_combo_3_1) outcome_6 = choice_config_3 outcome_7 = (choice_config_4 and fire_combo_4_1) outcome_8 = choice_config_4 outcome_9 = (choice_config_5 and fire_combo_5_1) outcome_10 = choice_config_5 outcome_11 = (choice_config_6 and fire_combo_6_1) outcome_12 = choice_config_6 outcome_13 = (choice_config_7 and fire_combo_7_1) outcome_14 = choice_config_7 outcome_15 = (choice_config_8 and fire_combo_8_1) outcome_16 = choice_config_8 outcome_17 = (choice_config_9 and fire_combo_9_1) outcome_18 = choice_config_9 outcome_19 = (choice_config_10 and fire_combo_10_1) outcome_20 = choice_config_10 outcome_21 = choice_config_11 outcome_22 = (choice_config_12 and fire_combo_12_1) outcome_23 = (choice_config_12 and fire_combo_12_2) outcome_24 = (choice_config_13 and fire_combo_13_1) outcome_25 = (choice_config_13 and fire_combo_13_2) outcome_26 = (choice_config_14 and fire_combo_14_1) outcome_27 = (choice_config_14 and fire_combo_14_2) outcome_28 = (choice_config_15 and fire_combo_15_1) outcome_29 = (choice_config_15 and fire_combo_15_2) outcome_30 = (choice_config_16 and fire_combo_16_1) outcome_31 = (choice_config_16 and fire_combo_16_2) outcome_32 = (choice_config_17 and fire_combo_17_1) outcome_33 = (choice_config_17 and fire_combo_17_2) outcome_34 = (choice_config_18 and fire_combo_18_1) outcome_35 = (choice_config_18 and fire_combo_18_2) outcome_36 = (choice_config_19 and fire_combo_19_1) outcome_37 = (choice_config_19 and fire_combo_19_2) outcome_38 = (choice_config_20 and fire_combo_20_1) outcome_39 = (choice_config_20 and fire_combo_20_2) outcome_40 = (choice_config_21 and fire_combo_21_1) outcome_41 = (choice_config_21 and fire_combo_21_2) # Determines if there is a fire if player.fire_chance <= C.fire_limit: player.fire = True elif outcome_none: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_2: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_4: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_6: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_7: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_9: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_11: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_17: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_19: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_21: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_23: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_24: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_28: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_31: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_32: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_36: player.fire = False elif player.role == C.Forest_1_Owner_ROLE and outcome_39: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_4: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_9: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_11: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_13: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_16: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_17: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_19: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_26: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_28: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_31: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_32: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_35: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_36: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_39: player.fire = False elif player.role == C.Forest_2_Owner_ROLE and outcome_40: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_1: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_4: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_5: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_8: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_9: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_11: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_13: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_19: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_21: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_22: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_25: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_26: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_32: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_35: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_36: player.fire = False elif player.role == C.Forest_3_Owner_ROLE and outcome_40: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_2: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_7: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_9: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_14: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_15: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_17: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_19: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_23: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_24: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_27: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_28: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_34: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_36: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_39: player.fire = False elif player.role == C.Forest_4_Owner_ROLE and outcome_41: player.fire = False elif player.role == C.Forest_5_Owner_ROLE and outcome_5: player.fire = False elif player.role == C.Forest_5_Owner_ROLE and outcome_7: player.fire = False elif player.role == C.Forest_5_Owner_ROLE and outcome_9: player.fire = False elif player.role == C.Forest_5_Owner_ROLE and outcome_11: player.fire = False elif player.role == C.Forest_5_Owner_ROLE and outcome_21: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_1: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_5: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_11: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_13: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_15: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_18: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_19: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_22: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_25: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_26: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_29: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_30: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_32: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_38: player.fire = False elif player.role == C.Forest_6_Owner_ROLE and outcome_40: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_2: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_3: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_5: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_7: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_9: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_12: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_15: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_17: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_21: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_24: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_27: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_28: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_30: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_33: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_34: player.fire = False elif player.role == C.Forest_7_Owner_ROLE and outcome_41: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_3: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_5: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_7: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_13: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_15: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_17: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_20: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_22: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_24: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_30: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_33: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_34: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_37: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_38: player.fire = False elif player.role == C.Forest_8_Owner_ROLE and outcome_41: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_1: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_3: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_5: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_7: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_10: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_11: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_13: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_15: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_21: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_22: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_26: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_29: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_30: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_34: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_37: player.fire = False elif player.role == C.Forest_9_Owner_ROLE and outcome_38: player.fire = False else: player.fire = True if player.fire: fire_report = 'There was a fire in your forest' elif not player.fire: fire_report = 'There was no fire in your forest' # Determining what forest utility will be if player.management_choice == 1: player.forest_utility = 300 elif player.management_choice != 1 and not player.fire: player.forest_utility = 500 elif player.management_choice != 1 and player.fire: player.forest_utility = 0 # Determining what home utility will be if player.management_choice == 1: player.home_utility = 3000 elif player.management_choice == 2: player.home_utility = 3000 elif player.management_choice == 3 and not player.fire: player.home_utility = 3000 elif player.management_choice == 3 and player.fire: player.home_utility = 0 # Determining what profit will be if player.management_choice == 1: player.round_profit = player.forest_utility + player.home_utility + C.Prescribed_Burn_Cost elif player.management_choice == 2: player.round_profit = player.forest_utility + player.home_utility + C.Defensive_Space_Cost elif player.management_choice == 3: player.round_profit = player.forest_utility + player.home_utility return { # individual reports 'forest_owned_report': forest_owned_report, "player.fire_started": player.fire_started, "fire_started_report": fire_started_report, 'management_choice_report': management_choice_report, 'fire_report': fire_report, 'player.forest_utility': player.forest_utility, 'player.home_utility': player.home_utility, 'player.round_profit': player.round_profit, # group reports 'group_choice_report_1': group_choice_report_1, 'group_choice_report_2': group_choice_report_2, 'group_choice_report_3': group_choice_report_3, 'group_choice_report_4': group_choice_report_4, 'group_choice_report_5': group_choice_report_5, 'group_choice_report_6': group_choice_report_6, 'group_choice_report_7': group_choice_report_7, 'group_choice_report_8': group_choice_report_8, 'group_choice_report_9': group_choice_report_9, 'group_fire_report_1': group_fire_report_1, 'group_fire_report_2': group_fire_report_2, 'group_fire_report_3': group_fire_report_3, 'group_fire_report_4': group_fire_report_4, 'group_fire_report_5': group_fire_report_5, 'group_fire_report_6': group_fire_report_6, 'group_fire_report_7': group_fire_report_7, 'group_fire_report_8': group_fire_report_8, 'group_fire_report_9': group_fire_report_9, 'group_fire_spread_report_1': group_fire_spread_report_1, 'group_fire_spread_report_2': group_fire_spread_report_2, 'group_fire_spread_report_3': group_fire_spread_report_3, 'group_fire_spread_report_4': group_fire_spread_report_4, 'group_fire_spread_report_5': group_fire_spread_report_5, 'group_fire_spread_report_6': group_fire_spread_report_6, 'group_fire_spread_report_7': group_fire_spread_report_7, 'group_fire_spread_report_8': group_fire_spread_report_8, 'group_fire_spread_report_9': group_fire_spread_report_9, 'outcome_none': outcome_none, 'outcome_1': outcome_1, 'outcome_2': outcome_2, 'outcome_3': outcome_3, 'outcome_4': outcome_4, 'outcome_5': outcome_5, 'outcome_6': outcome_6, 'outcome_7': outcome_7, 'outcome_8': outcome_8, 'outcome_9': outcome_9, 'outcome_10': outcome_10, 'outcome_11': outcome_11, 'outcome_12': outcome_12, 'outcome_13': outcome_13, 'outcome_14': outcome_14, 'outcome_15': outcome_15, 'outcome_16': outcome_16, 'outcome_17': outcome_17, 'outcome_18': outcome_18, 'outcome_19': outcome_19, 'outcome_20': outcome_20, 'outcome_21': outcome_21, 'outcome_22': outcome_22, 'outcome_23': outcome_23, 'outcome_24': outcome_24, 'outcome_25': outcome_25, 'outcome_26': outcome_26, 'outcome_27': outcome_27, 'outcome_28': outcome_28, 'outcome_29': outcome_29, 'outcome_30': outcome_30, 'outcome_31': outcome_31, 'outcome_32': outcome_32, 'outcome_33': outcome_33, 'outcome_34': outcome_34, 'outcome_35': outcome_35, 'outcome_36': outcome_36, 'outcome_37': outcome_37, 'outcome_38': outcome_38, 'outcome_39': outcome_39, 'outcome_40': outcome_40, 'outcome_41': outcome_41, } class QuestionsWaitPage(WaitPage): pass class Questions(Page): form_model = "player" form_fields = ["fire_on_actual_property", "damage_to_actual_home", "damage_to_other_physical_structure", "damage_to_actual_forest", "damage_to_other", "other_damage", "first_name", "last_name", "email"] @staticmethod def is_displayed(player: Player): return player.round_number == C.NUM_ROUNDS page_sequence = [IntroductionPage, IntroWaitPage, ChoicePage, ResultsWaitPage, Results, QuestionsWaitPage, Questions]