Simulation class Simulation: def init(self): self.simulation = { "wages": { "name":…
- User
Simulation
class Simulation: def init(self): self.simulation = { "wages": { "name": "Average Wage", "desc": "Average earnings per hour.", "value": 3.24, "minval": 0, "maxval": None, "type": "economic", } }
codeself.policy_effects = { "minimum_wage": "wages", } def apply_policy(self, policy): policy_key = list(policy.keys())[0] if policy_key in self.policy_effects: sim_key = self.policy_effects[policy_key] sim_data = self.simulation[sim_key] new_value = max(sim_data["minval"], policy[policy_key]["value"]) if sim_data["maxval"] is not None: new_value = min(sim_data["maxval"], new_value) sim_data["value"] = new_valuePolicies
class Policies: def init(self): self.policies = { "minimum_wage": { "name": "Minimum Wage", "desc": "Legal minimum wage employers must pay out.", "active": False, "value": 7, "minval": 0, "maxval": None, "type": "economic", }, }
codedef apply_policies(self, sim): for policy_key, policy_data in self.policies.items(): if policy_data["active"]: sim.apply_policy({policy_key: policy_data})Turn Calculation
class Turns: pass
Gamestate
class GameState: def init(self): self.sim = Simulation() self.pol = Policies() self.turns = Turns()
codeself.commands={ # Creates the commands dictionary. "SOCIAL": social, "ECONOMIC": economic, "POLITICAL": political, "FOREIGN": foreign, "QUIT": return_menu, "DEV": developer, } self.is_running = True # Is game running? True! self.in_menu = True # Is game in menu? True!def main(): # Main menu. Barebones. Will eventually require a rehaul with new game, load game, options, etc. game_state = GameState() while game_state.in_menu: print("""
- Assistant