| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- import random
- from actions import Actions
- from events import Events
- from supporters import Supporters
- class PoliticalSimulationGame:
- def __init__(self):
- self.money = 100
- self.influence = 50
- self.public_support = 50
- self.day = 1
- self.policies = []
- self.opponents = ["Opponent 1", "Opponent 2", "Opponent 3"]
- self.gdp = 1000 # Gross Domestic Product
- self.unemployment_rate = 5 # Unemployment rate in percentage
- self.tax_rate = 20 # Tax rate in percentage
- self.military_budget = 50 # Initial military budget
- self.military_strength = 100 # Initial military strength
- self.actions_per_day = 3 # Number of actions allowed per day
- self.post_election = False
- self.supporters = Supporters()
- def display_status(self):
- print(f"\n*****************************")
- print(f"Day {self.day}")
- print(f"Money: ${self.money}")
- print(f"Influence: {self.influence}")
- print(f"Public Support: {self.public_support}%")
- print(f"Policies: {', '.join(self.policies) if self.policies else 'None'}")
- print(f"GDP: ${self.gdp}")
- print(f"Unemployment Rate: {self.unemployment_rate}%")
- print(f"Tax Rate: {self.tax_rate}%")
- print(f"Military Budget: ${self.military_budget}")
- print(f"Military Strength: {self.military_strength}")
- self.supporters.display()
- print(f"\n*****************************")
- def take_action(self, action_number):
- actions = Actions(self)
- if action_number == "1":
- actions.campaign()
- elif action_number == "2":
- actions.pass_legislation()
- elif action_number == "3":
- actions.hold_rally()
- elif action_number == "4":
- actions.media_campaign()
- elif action_number == "5":
- if not actions.opponent_friction() or not actions.foreign_interference():
- return False # Skip fundraising if sabotaged
- actions.fundraise()
- elif action_number == "6":
- actions.debate()
- elif action_number == "7":
- actions.set_tax_policy()
- elif action_number == "8":
- actions.invest_in_sector()
- elif action_number == "9":
- actions.allocate_military_budget()
- self.display_status() # Show status after each action
- return True
- def end_day(self):
- self.day += 1
- self.money += self.tax_rate * 10 # Example revenue generation
- print(f"Day ended. You earned ${self.tax_rate * 10} from taxes.")
- self.display_status() # Show status at end of day
- def check_win_condition(self):
- if self.public_support >= 100:
- print("Congratulations! You've won the election!")
- self.post_election = True
- return True
- elif self.public_support <= 0:
- print("You've lost the election. Better luck next time.")
- return True
- return False
- def post_election_actions(self):
- print("Congratulations on winning the election! Now you need to maintain your approval ratings and pass significant legislation.")
- self.actions_per_day = 2 # Fewer actions per day post-election to increase difficulty
- while True:
- self.display_status()
- actions_left = self.actions_per_day
- while actions_left > 0:
- print("Choose an action:")
- print("1. Pass Legislation")
- print("2. Hold Rally")
- print("3. Media Campaign")
- print("4. Allocate Military Budget")
- choice = input("Enter the number of your choice: ")
- if not self.take_action(choice):
- continue
- actions_left -= 1
- if random.randint(1, 100) <= 30:
- self.random_event()
- if self.check_win_condition():
- return
- self.end_day()
- def play(self):
- print("Welcome to the Enhanced Political Simulation Game with Economic, Military, Opponent Friction, and Demographic Elements!")
- while True:
- if self.post_election:
- self.post_election_actions()
- break
- self.display_status()
- actions_left = self.actions_per_day
- while actions_left > 0:
- print("Choose an action:")
- print("1. Campaign")
- print("2. Pass Legislation")
- print("3. Hold Rally")
- print("4. Media Campaign")
- print("5. Fundraise")
- print("6. Debate")
- print("7. Set Tax Policy")
- print("8. Invest in a Sector")
- print("9. Allocate Military Budget")
- choice = input("Enter the number of your choice: ")
- if not self.take_action(choice):
- continue
- actions_left -= 1
- if random.randint(1, 100) <= 30:
- self.random_event()
- if self.check_win_condition():
- break
- self.end_day()
- def random_event(self):
- events = Events(self)
- events.random_event()
- self.display_status() # Show status after random event
|