Create a basic Oregon trail game but add as many features as possible
- User
Create a basic Oregon trail game but add as many features as possible
Assistant
Of course! Here is a comprehensive, text-based Oregon Trail game written in Python. I've incorporated the classic elements and added a multitude of features to enhance strategy, replayability, and flavor.
Features Included:
- Character Customization: Name your party leader and four companions.
- Profession Choice: Start as a Banker, Doctor, or Farmer, each with unique starting bonuses.
- Initial Shop: Strategically purchase oxen, food, ammunition, and spare parts before you leave.
- Resource Management: Carefully manage food, money, oxen, ammo, and wagon parts.
- Pacing & Rations: Control your travel pace and food consumption, which affects health, speed, and resource usage.
- Landmarks & Distance: The journey is over 2,000 miles, marked by famous forts and natural landmarks.
- Health & Sickness: Party members have individual health. They can get sick with various diseases (dysentery, cholera, measles) or suffer injuries (snakebite, broken arm).
- Morale System: The party's morale affects their health and the likelihood of positive events.
- Interactive Mini-Games:
- Hunting: A typing-based mini-game where speed determines your haul.
- River Crossings: A choice-based challenge where you can ford, caulk, or hire a ferry, each with different risks and costs.
- Dynamic Random Events: A wide array of over 15 random events, both good and bad, including:
- Weather changes (heavy rain, blizzards, beautiful days)
- Finding abandoned wagons or wild berries
- Theft in the night
- Wagon breakdowns (axle, wheel, tongue)
- Oxen getting sick or dying
- Meeting friendly travelers who offer trades.
- Trading: At forts, you have the opportunity to trade with other settlers, with fluctuating prices.
- Date & Time Progression: The game tracks the date, which influences the likelihood of certain weather events (e.g., blizzards in winter).
- End Game Summary: A detailed summary of your journey, including a final score and the fate of your party members (with tombstones for the fallen).
The Code
Just copy and paste this code into a Python file (e.g.,
oregon_trail.py) and run it from your terminal.import random import time import datetime # --- Game Constants --- GAME_TITLE = "THE OREGON TRAIL: EXTENDED EDITION" MIN_PARTY_MEMBERS = 1 MAX_PARTY_MEMBERS = 5 STARTING_MONEY_BANKER = 1600 STARTING_MONEY_DOCTOR = 1200 STARTING_MONEY_FARMER = 800 TOTAL_DISTANCE = 2040 # --- Landmark Data (Name, Distance from start) --- LANDMARKS = [ ("Independence, Missouri", 0), ("Kansas River Crossing", 102), ("Big Blue River Crossing", 185), ("Fort Kearney", 304), ("Chimney Rock", 552), ("Fort Laramie", 640), ("Independence Rock", 830), ("South Pass", 932), ("Fort Bridger", 1057), ("Green River Crossing", 1151), ("Soda Springs", 1295), ("Fort Hall", 1395), ("Snake River Crossing", 1534), ("Fort Boise", 1808), ("Blue Mountains", 1928), ("The Dalles", 2008), ("Oregon City, Oregon", 2040) ] # --- Helper Functions --- def clear_screen(): # A simple way to clear the screen for better readability print("\n" * 50) def press_enter_to_continue(): input("\nPress Enter to continue...") def display_header(title): print("=" * 60) print(title.center(60)) print("=" * 60) # --- Game Classes --- class PartyMember: def __init__(self, name, is_leader=False): self.name = name self.is_leader = is_leader self.health = 100 self.status = "Healthy" self.is_alive = True def reduce_health(self, amount, reason=""): self.health -= amount if self.health <= 0: self.health = 0 self.is_alive = False self.status = f"Deceased ({reason})" elif self.health < 25: self.status = "Very Poor" elif self.health < 50: self.status = "Poor" elif self.health < 75: self.status = "Fair" def increase_health(self, amount): self.health = min(100, self.health + amount) self.update_status() def update_status(self): if self.is_alive: if self.health >= 75: self.status = "Healthy" elif self.health >= 50: self.status = "Fair" elif self.health >= 25: self.status = "Poor" else: self.status = "Very Poor" class GameState: def __init__(self): self.party = [] self.money = 0 self.oxen = 0 self.food = 0 self.ammo = 0 self.wagon_parts = {"wheels": 0, "axles": 0, "tongues": 0} self.tombstones = [] self.distance_traveled = 0 self.current_date = datetime.date(1848, 3, 1) self.pace = "steady" # steady, strenuous, grueling self.rations = "filling" # filling, meager, bare-bones self.morale = 100 # 0-100 scale self.current_landmark_index = 0 self.distance_to_next_landmark = LANDMARKS[1][1] def add_party_member(self, name, is_leader=False): self.party.append(PartyMember(name, is_leader)) def living_party_members(self): return [p for p in self.party if p.is_alive] def advance_day(self, days=1): self.current_date += datetime.timedelta(days=days) def change_morale(self, amount): self.morale = max(0, min(100, self.morale + amount)) # --- Setup Phase --- def setup_game(): game = GameState() clear_screen() display_header(GAME_TITLE) print("Welcome to a new adventure on the Oregon Trail!") print("You can choose your profession and name your party.") press_enter_to_continue() # 1. Choose Profession choose_profession(game) # 2. Name Party name_party(game) # 3. Visit the Store visit_store(game) return game def choose_profession(game): while True: clear_screen() display_header("Choose Your Profession") print("1. Be a banker from Boston") print(" - Starts with $1600. Most money, but no special skills.") print("\n2. Be a doctor from Illinois") print(" - Starts with $1200. Party is less likely to get sick.") print("\n3. Be a farmer from Missouri") print(" - Starts with $800. Best at hunting and foraging.") choice = input("\nWhat is your choice? (1-3) ") if choice == '1': game.money = STARTING_MONEY_BANKER game.profession = "Banker" break elif choice == '2': game.money = STARTING_MONEY_DOCTOR game.profession = "Doctor" break elif choice == '3': game.money = STARTING_MONEY_FARMER game.profession = "Farmer" break else: print("Invalid choice. Please enter 1, 2, or 3.") time.sleep(1.5) def name_party(game): clear_screen() display_header("Name Your Party") leader_name = "" while not leader_name: leader_name = input("What is the name of the wagon leader? ").strip() game.add_party_member(leader_name, is_leader=True) print("\nEnter the names of the other four members of your party:") for i in range(MAX_PARTY_MEMBERS - 1): member_name = "" while not member_name: member_name = input(f"Party member {i+2}: ").strip() game.add_party_member(member_name) def visit_store(game): store_items = { "1": {"name": "Oxen", "price": 40, "unit": "per yoke (2 oxen)"}, "2": {"name": "Food", "price": 0.20, "unit": "per pound"}, "3": {"name": "Ammunition", "price": 2, "unit": "per box of 20 bullets"}, "4": {"name": "Wagon Wheel", "price": 10, "unit": "each"}, "5": {"name": "Wagon Axle", "price": 10, "unit": "each"}, "6": {"name": "Wagon Tongue", "price": 10, "unit": "each"} } while True: clear_screen() display_header("Matt's General Store - Independence, Missouri") print(f"You have ${game.money:.2f} to spend.\n") for key, item in store_items.items(): print(f"{key}. {item['name']:<15} - ${item['price']:.2f} {item['unit']}") print("\nYour current inventory:") print(f"- Oxen: {game.oxen}") print(f"- Food: {game.food} lbs") print(f"- Ammunition: {game.ammo} bullets") print(f"- Wagon Wheels: {game.wagon_parts['wheels']}, Axles: {game.wagon_parts['axles']}, Tongues: {game.wagon_parts['tongues']}") print("\nWhat would you like to buy? (Enter number, or 'done' to leave)") choice = input("> ").lower() if choice == 'done': if game.oxen == 0: print("You can't leave without any oxen to pull your wagon!") time.sleep(2) continue if game.food == 0: print("Are you sure you want to leave with no food?") if input("Leave anyway? (y/n) ").lower() != 'y': continue break if choice in store_items: item = store_items[choice] quantity_str = input(f"How many {item['name']} would you like to buy? ") if quantity_str.isdigit(): quantity = int(quantity_str) cost = quantity * item['price'] if game.money >= cost: game.money -= cost if choice == '1': game.oxen += quantity * 2 elif choice == '2': game.food += quantity elif choice == '3': game.ammo += quantity * 20 elif choice == '4': game.wagon_parts['wheels'] += quantity elif choice == '5': game.wagon_parts['axles'] += quantity elif choice == '6': game.wagon_parts['tongues'] += quantity else: print("You don't have enough money for that.") time.sleep(1.5) else: print("Invalid quantity.") time.sleep(1.5) # --- Main Game Loop --- def main_loop(game): while True: display_status(game) # Check for game over conditions if not game.living_party_members() or game.oxen <= 0: game_over(game, "Your entire party has perished or you have no oxen to continue.") break if game.distance_traveled >= TOTAL_DISTANCE: win_game(game) break action = get_player_action(game) if action == '1': # Travel travel_turn(game) elif action == '2': # Rest rest_turn(game) elif action == '3': # Hunt hunt_turn(game) elif action == '4': # Change Pace change_pace(game) elif action == '5': # Change Rations change_rations(game) elif action == '6': # Trade trade_turn(game) # After any turn, check for death from low health or starvation check_for_deaths(game) def display_status(game): clear_screen() display_header("Journey Status") date_str = game.current_date.strftime("%A, %B %d, %Y") print(f"Date: {date_str}") current_loc = LANDMARKS[game.current_landmark_index][0] next_loc = LANDMARKS[game.current_landmark_index + 1][0] print(f"Current Location: Traveled {game.distance_traveled} miles. Near {current_loc}.") print(f"Next Landmark: {game.distance_to_next_landmark} miles to {next_loc}.") morale_desc = "Good" if game.morale < 30: morale_desc = "Very Poor" elif game.morale < 60: morale_desc = "Poor" elif game.morale < 80: morale_desc = "Fair" print("\nResources:") print(f" Food: {int(game.food)} lbs | Money: ${game.money:.2f} | Oxen: {game.oxen}") print(f" Ammo: {game.ammo} bullets | Wagon Parts: {game.wagon_parts['wheels']} Wheels, {game.wagon_parts['axles']} Axles, {game.wagon_parts['tongues']} Tongues") print(f" Pace: {game.pace.capitalize()} | Rations: {game.rations.capitalize()} | Morale: {morale_desc}") print("\nParty Health:") for member in game.party: leader_tag = "(Leader)" if member.is_leader else "" print(f" - {member.name:<15} {leader_tag:<9}: {member.status}") press_enter_to_continue() def get_player_action(game): while True: clear_screen() display_header("What would you like to do?") print("1. Travel") print("2. Rest") print("3. Hunt") print("4. Change Pace") print("5. Change Food Rations") current_loc_name = LANDMARKS[game.current_landmark_index][0] if "Fort" in current_loc_name or "Crossing" in current_loc_name: print("6. Trade at landmark") choice = input("\nYour choice? ") if choice in ['1', '2', '3', '4', '5']: return choice elif choice == '6' and ("Fort" in current_loc_name or "Crossing" in current_loc_name): return choice else: print("Invalid selection.") time.sleep(1) # --- Turn Actions --- def travel_turn(game): pace_mult = {"steady": 1, "strenuous": 1.5, "grueling": 2} pace_health_risk = {"steady": 1, "strenuous": 2, "grueling": 4} days_to_travel = 7 distance_per_day = (10 + game.oxen) * pace_mult[game.pace] distance_covered = int(distance_per_day * days_to_travel) # Food Consumption rations_mult = {"filling": 3, "meager": 2, "bare-bones": 1} food_needed = len(game.living_party_members()) * rations_mult[game.rations] * days_to_travel if game.food < food_needed: print("You don't have enough food to travel for a week. You'll travel until food runs out.") days_can_travel = int(game.food / (len(game.living_party_members()) * rations_mult[game.rations])) distance_covered = int(distance_per_day * days_can_travel) game.food = 0 game.advance_day(days_can_travel) print(f"You traveled for {days_can_travel} days before running out of food.") # Health penalty for running out of food for member in game.living_party_members(): member.reduce_health(15, "Starvation") game.change_morale(-20) else: game.food -= food_needed game.advance_day(days_to_travel) # Health effects of pace and rations for member in game.living_party_members(): health_change = 0 if game.rations == "meager": health_change -= 5 if game.rations == "bare-bones": health_change -= 10 if game.pace == "strenuous": health_change -= 5 if game.pace == "grueling": health_change -= 15 if health_change < 0: member.reduce_health(abs(health_change), "Exhaustion") game.distance_traveled += distance_covered game.distance_to_next_landmark -= distance_covered print(f"\nYou traveled {distance_covered} miles in {days_to_travel} days.") # Landmark Check if game.distance_to_next_landmark <= 0: game.current_landmark_index += 1 current_landmark = LANDMARKS[game.current_landmark_index] print(f"\nCongratulations! You have reached {current_landmark[0]}.") game.change_morale(15) # Recalculate distance to the *next* landmark if game.current_landmark_index + 1 < len(LANDMARKS): next_landmark_dist = LANDMARKS[game.current_landmark_index + 1][1] game.distance_to_next_landmark = next_landmark_dist - game.distance_traveled # River Crossing Event if "Crossing" in current_landmark[0]: handle_river_crossing(game) else: # Random Event Check (only if not at a landmark) handle_random_event(game) press_enter_to_continue() def rest_turn(game): days_to_rest = int(input("How many days would you like to rest? (1-7) ") or "3") days_to_rest = max(1, min(7, days_to_rest)) food_needed = len(game.living_party_members()) * 2 * days_to_rest # Resting uses less food than bare-bones travel if game.food < food_needed: print("You don't have enough food to rest that long.") time.sleep(2) return game.food -= food_needed game.advance_day(days_to_rest) # Health and morale boost health_gained = 5 * days_to_rest for member in game.living_party_members(): member.increase_health(health_gained) game.change_morale(5 * days_to_rest) print(f"\nYou rest for {days_to_rest} days. Your party's health and morale have improved.") press_enter_to_continue() def hunt_turn(game): clear_screen() display_header("Hunting") if game.ammo == 0: print("You have no ammunition to hunt with!") press_enter_to_continue() return print("You head out into the wilderness to find game...") time.sleep(2) game.advance_day() # Simple typing mini-game for hunting animals = ["bison", "deer", "rabbit", "squirrel"] animal = random.choice(animals) print(f"You spot a {animal}!") word = "BANG" start_time = time.time() typed_word = input(f"Type '{word}' to shoot! > ") end_time = time.time() time_taken = end_time - start_time game.ammo = max(0, game.ammo - random.randint(5, 15)) if typed_word.strip().upper() == word and time_taken < 3: food_gained = 0 if time_taken < 0.8: food_gained = 100 # Excellent shot! elif time_taken < 1.5: food_gained = 70 # Good shot elif time_taken < 3: food_gained = 40 # Decent shot if game.profession == "Farmer": # Farmer bonus food_gained = int(food_gained * 1.5) print(f"Success! You shot the {animal} and brought back {food_gained} lbs of food.") game.food += food_gained game.change_morale(10) else: print("You missed and the animal got away.") game.change_morale(-5) press_enter_to_continue() def trade_turn(game): clear_screen() display_header("Trading with a Fellow Traveler") print("You meet another pioneer willing to trade.\n") # Generate what the other traveler has and wants wants_item = random.choice(["food", "ammo", "wheel", "axle", "tongue"]) offers_item = random.choice(["food", "ammo", "wheel", "axle", "tongue"]) # Ensure they aren't the same item while wants_item == offers_item: offers_item = random.choice(["food", "ammo", "wheel", "axle", "tongue"]) # Generate quantities and ratios wants_qty = random.randint(10, 50) if wants_item in ["food", "ammo"] else 1 offers_qty = random.randint(10, 50) if offers_item in ["food", "ammo"] else 1 item_map = {"food": "lbs of food", "ammo": "bullets", "wheel": "wagon wheel(s)", "axle": "wagon axle(s)", "tongue": "wagon tongue(s)"} print(f"They are looking for {wants_qty} {item_map[wants_item]}.") print(f"They are offering {offers_qty} {item_map[offers_item]} in return.") choice = input("\nDo you want to make this trade? (y/n) ").lower() if choice == 'y': # Check if player has the required item can_trade = False if wants_item == "food" and game.food >= wants_qty: can_trade = True elif wants_item == "ammo" and game.ammo >= wants_qty: can_trade = True elif wants_item == "wheel" and game.wagon_parts["wheels"] >= wants_qty: can_trade = True elif wants_item == "axle" and game.wagon_parts["axles"] >= wants_qty: can_trade = True elif wants_item == "tongue" and game.wagon_parts["tongues"] >= wants_qty: can_trade = True if can_trade: # Perform the trade if wants_item == "food": game.food -= wants_qty elif wants_item == "ammo": game.ammo -= wants_qty elif wants_item == "wheel": game.wagon_parts["wheels"] -= wants_qty elif wants_item == "axle": game.wagon_parts["axles"] -= wants_qty elif wants_item == "tongue": game.wagon_parts["tongues"] -= wants_qty if offers_item == "food": game.food += offers_qty elif offers_item == "ammo": game.ammo += offers_qty elif offers_item == "wheel": game.wagon_parts["wheels"] += offers_qty elif offers_item == "axle": game.wagon_parts["axles"] += offers_qty elif offers_item == "tongue": game.wagon_parts["tongues"] += offers_qty print("Trade successful!") game.change_morale(5) else: print("You don't have the items they need for the trade.") game.change_morale(-2) else: print("You decide not to trade.") press_enter_to_continue() def change_pace(game): while True: clear_screen() display_header("Change Travel Pace") print(f"Current pace: {game.pace.capitalize()}") print("1. Steady: Slowest pace, low health risk.") print("2. Strenuous: Faster, moderate health risk.") print("3. Grueling: Fastest pace, high health risk.") choice = input("\nChoose a new pace (1-3): ") if choice == '1': game.pace = "steady" break elif choice == '2': game.pace = "strenuous" break elif choice == '3': game.pace = "grueling" break else: print("Invalid choice.") time.sleep(1) def change_rations(game): while True: clear_screen() display_header("Change Food Rations") print(f"Current rations: {game.rations.capitalize()}") print("1. Filling: Large portions, good for morale and health.") print("2. Meager: Smaller portions, saves food but affects health.") print("3. Bare-bones: Minimal food, high health risk.") choice = input("\nChoose new rations (1-3): ") if choice == '1': game.rations = "filling" break elif choice == '2': game.rations = "meager" break elif choice == '3': game.rations = "bare-bones" break else: print("Invalid choice.") time.sleep(1) # --- Events --- def handle_random_event(game): event_chance = random.randint(1, 100) # Good events are more likely with high morale if event_chance <= 15 + (game.morale // 10): # Good Event event = random.choice(["find_food", "good_weather", "abandoned_wagon"]) if event == "find_food": food_found = random.randint(10, 30) print(f"You find a patch of wild berries! You gather {food_found} lbs of food.") game.food += food_found game.change_morale(10) elif event == "good_weather": print("The weather is beautiful for the entire week. Your party's spirits are high.") game.change_morale(15) elif event == "abandoned_wagon": part_found = random.choice(["a wheel", "an axle", "a tongue", "20 bullets of ammunition"]) print(f"You find an abandoned wagon and salvage {part_found}!") if "wheel" in part_found: game.wagon_parts["wheels"] += 1 elif "axle" in part_found: game.wagon_parts["axles"] += 1 elif "tongue" in part_found: game.wagon_parts["tongues"] += 1 elif "ammo" in part_found: game.ammo += 20 game.change_morale(10) # Bad events are more likely with low morale elif event_chance >= 75 - (game.morale // 10): # Bad Event events = ["sickness", "wagon_break", "thief", "bad_weather", "ox_injury", "lost_trail"] # Make sickness more likely if a doctor isn't present if game.profession == "Doctor": sickness_chance = 10 else: sickness_chance = 25 if random.randint(1, 100) <= sickness_chance: event = "sickness" else: event = random.choice(events[1:]) if event == "sickness" and game.living_party_members(): member = random.choice(game.living_party_members()) disease = random.choice(["Dysentery", "Cholera", "Measles", "a snakebite", "a broken arm"]) damage = {"Dysentery": 30, "Cholera": 40, "Measles": 25, "a snakebite": 35, "a broken arm": 20} print(f"Oh no! {member.name} has {disease}.") member.reduce_health(damage[disease], disease) game.change_morale(-15) elif event == "wagon_break": part_broken = random.choice(["wheel", "axle", "tongue"]) print(f"Disaster! Your wagon's {part_broken} has broken.") if game.wagon_parts[f"{part_broken}s"] > 0: game.wagon_parts[f"{part_broken}s"] -= 1 print(f"Luckily, you have a spare. You spend a day making repairs.") game.advance_day() game.change_morale(-5) else: print("You have no spare parts! You are stuck until you can find one.") # This is a soft game-over state until a part is found/traded # For simplicity, we'll just lose a lot of time days_lost = random.randint(5, 10) print(f"You lose {days_lost} days trying to fashion a replacement.") game.advance_day(days_lost) game.change_morale(-25) elif event == "thief": food_stolen = random.randint(10, 50) print(f"A thief in the night! You wake to find {food_stolen} lbs of food missing.") game.food = max(0, game.food - food_stolen) game.change_morale(-10) elif event == "bad_weather": weather = random.choice(["heavy rain", "a blizzard", "extreme heat"]) days_lost = random.randint(2, 4) print(f"You are caught in {weather}. You lose {days_lost} days waiting for it to pass.") game.advance_day(days_lost) game.change_morale(-10) for member in game.living_party_members(): member.reduce_health(10, "Weather") elif event == "ox_injury" and game.oxen > 0: print("One of your oxen has fallen ill and died.") game.oxen -= 1 game.change_morale(-20) elif event == "lost_trail": days_lost = random.randint(3, 6) print(f"You lose the trail and wander for {days_lost} days before finding it again.") game.advance_day(days_lost) game.change_morale(-10) def handle_river_crossing(game): display_header(f"River Crossing: {LANDMARKS[game.current_landmark_index][0]}") depth = random.randint(2, 8) width = random.randint(100, 500) print(f"You must cross the river. It is {depth} feet deep and {width} feet wide.") while True: print("\nHow will you cross?") print("1. Attempt to ford the river") print("2. Caulk the wagon and float it across") print("3. Pay for a ferry ($20)") choice = input("> ") if choice == '1': # Ford print("You attempt to ford the river...") time.sleep(2) # Risk increases with depth if depth > 4: risk_chance = 0.5 # 50% chance of problems else: risk_chance = 0.2 # 20% if random.random() < risk_chance: print("Disaster! The wagon tipped over in the strong current.") lost_item = random.choice(["food", "ammo", "parts", "person"]) if lost_item == "food": food_lost = int(game.food * 0.25) print(f"You lost {food_lost} lbs of food.") game.food -= food_lost elif lost_item == "ammo": ammo_lost = int(game.ammo * 0.3) print(f"You lost {ammo_lost} bullets.") game.ammo -= ammo_lost elif lost_item == "parts" and game.wagon_parts["wheels"] + game.wagon_parts["axles"] + game.wagon_parts["tongues"] > 0: part_lost = random.choice([p for p, c in game.wagon_parts.items() if c > 0]) print(f"You lost a spare wagon {part_lost[:-1]}.") game.wagon_parts[part_lost] -= 1 elif game.living_party_members(): drowned_person = random.choice(game.living_party_members()) print(f"Tragically, {drowned_person.name} was swept away by the current and drowned.") drowned_person.reduce_health(100, "Drowned") game.change_morale(-30) else: print("You made it across successfully!") game.change_morale(5) break elif choice == '2': # Caulk and float print("You caulk the wagon and float it across...") time.sleep(2) if random.random() < 0.3: # 30% chance of failure print("The caulking failed! The wagon took on water.") food_lost = int(game.food * 0.15) print(f"You lost {food_lost} lbs of food.") game.food -= food_lost game.change_morale(-15) else: print("You made it across successfully!") game.change_morale(5) break elif choice == '3': # Ferry if game.money >= 20: print("You pay $20 for a safe ferry across the river.") game.money -= 20 print("You made it across safely.") game.change_morale(5) break else: print("You don't have enough money for the ferry.") time.sleep(2) else: print("Invalid choice.") def check_for_deaths(game): for member in list(game.living_party_members()): if member.health == 0 and member.is_alive: # Should already be dead but double check member.is_alive = False member.status = "Deceased" if not member.is_alive and member not in [t[0] for t in game.tombstones]: clear_screen() display_header(f"{member.name} has died.") print(f"Date of death: {game.current_date.strftime('%B %d, %Y')}") print(f"Cause of death: {member.status.split('(')[-1][:-1]}") # Extracts reason epitaph = input("Enter a short epitaph for their tombstone:\n> ") game.tombstones.append((member, game.current_date, epitaph)) game.change_morale(-25) press_enter_to_continue() # --- End Game --- def game_over(game, reason): clear_screen() display_header("The Trail Ends Here") print(reason) print("\nYour journey has come to a premature and unfortunate end.") display_final_summary(game) press_enter_to_continue() def win_game(game): clear_screen() display_header("Congratulations!") print("You have successfully reached Oregon City!") print("Your long and difficult journey is finally over.") display_final_summary(game) press_enter_to_continue() def display_final_summary(game): print("\n--- FINAL SUMMARY ---") print(f"Profession: {game.profession}") print(f"Distance Traveled: {game.distance_traveled} miles") # Scoring score = 0 score += len(game.living_party_members()) * 500 # Score for survivors score += int(game.money) # Score for money score += game.food * 2 score += game.oxen * 50 score += (game.wagon_parts['wheels'] + game.wagon_parts['axles'] + game.wagon_parts['tongues']) * 25 print("\nParty Survivors:") for member in game.living_party_members(): print(f" - {member.name}") if not game.living_party_members(): print(" None") if game.tombstones: print("\nIn Memoriam:") for member, date, epitaph in game.tombstones: print(f"\n HERE LIES {member.name.upper()}") print(f" Died: {date.strftime('%B %d, %Y')}") print(f" \"{epitaph}\"") print("\n----------------------") print(f"FINAL SCORE: {score}") print("----------------------") # --- Main Execution --- if __name__ == "__main__": game_state = setup_game() if game_state: clear_screen() display_header("The Journey Begins!") print("Your wagon is packed and your party is ready.") print("You are leaving Independence, Missouri on March 1, 1848.") print("Good luck.") press_enter_to_continue() main_loop(game_state) print("\nThank you for playing!")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.