def __init__(self):
self.reputation = 0
self.level = 1
self.story_progress = 0
self.environment_clean = True
self.sterile_conditions = True
self.equipment_sterilized = False
def start(self):
print("Welcome to Lab Life: From Intern to Expert!")
while True:
self.show_options()
def show_options(self):
print("\nChoose an action:")
print("1. Perform a Lab Test")
print("2. Maintain the Lab")
print("3. Sterilize Equipment") # New option for sterilization
print("4. Check Reputation and Level")
print("5. Save Game")
print("6. Exit Game") # Update the number for exiting the game
choice = input("> ")
if choice == '1':
self.perform_lab_test()
elif choice == '2':
self.maintain_lab()
elif choice == '3':
self.sterilize_equipment() # New method for sterilization
elif choice == '4':
self.check_status()
elif choice == '6':
exit()
else:
print("Invalid choice. Please try again.")
def sterilize_equipment(self):
self.environment_clean = True
print("You have sterilized the equipment, reducing the risk of contamination.")
def maintain_lab(self):
self.environment_clean = True
print("You spend time cleaning and organizing the lab. The risk of contamination is reduced.")
def check_status(self):
# Placeholder for check_status method
print(f"Reputation: {self.reputation}, Level: {self.level}")
def perform_lab_test(self):
success_rate = 0.4
if not self.equipment_sterilized:
success_rate -= 0.2 # Decrease success rate if equipment is not sterilized
if random.random() < success_rate:
self.reputation += 10
print("Test successful. Reputation increased.")
else:
self.reputation -= 10 if self.reputation >= 10 else 0
self.provide_failure_reason()
print("Test failed.")
def provide_failure_reason(self):
reasons = [
"contamination due to unsterilized equipment",
"poor time management resulting in delayed testing",
"insufficient polymerase enzyme used in the process",
"false positive result caused by cross-contamination"
]
print("Reason for failure:", random.choice(reasons))
# ... [rest of the class code remains unchanged] ...
import random
class LabGame:
Create an instance of the game and start it
game = LabGame() game.start()