Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/birdfarmer_justanotherwednesday.json
T

1 line
60 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "birdfarmer/justanotherwednesday", "files": {"Engine/HumanDuel.cs": {"3e7d7e17121efe1d5a9826ed2f0fd5d707df929a": {"t": 1785745820.0240743, "n": 39288, "h": "64a12eb022552651", "c": "using System.Text;\nusing System.Text.Json;\n\nnamespace JustAnotherWednesday;\n\npublic static class HumanDuel\n{\n // --- GameAction enum ---\n private enum GameAction\n {\n AcquireTransport,\n SecureFood,\n StrengthenShelter,\n AcquireEnergy,\n BuildInfluence,\n PreserveLiquidity\n }\n\n // --- Player State ---\n private class PlayerState\n {\n public int Liquidity { get; set; } = 50;\n public int Food { get; set; } = 50;\n public int Shelter { get; set; } = 50;\n public int Security { get; set; } = 50;\n public int Mobility { get; set; } = 50;\n public int Influence { get; set; } = 50;\n public int Energy { get; set; } = 50;\n public Option MoneyOption { get; set; } = Option.B;\n public int CashReceived { get; set; } = 0;\n public bool MoneyReceived { get; set; } = false;\n\n public string GetSummary()\n {\n return $\"💧 Liquidity: {Liquidity} 🍖 Food: {Food} 🏠 Shelter: {Shelter} 🔒 Security: {Security} 🚗 Mobility: {Mobility} 🤝 Influence: {Influence} ⚡ Energy: {Energy}\";\n }\n }\n\n // --- Location database ---\n private static readonly Dictionary<Location, List<string>> LocationNames = new()\n {\n { Location.HighCostCity, new List<string> {\n \"New York City, USA\", \"London, UK\", \"Singapore\", \"Tokyo, Japan\",\n \"Sydney, Australia\", \"Paris, France\", \"Hong Kong, China\",\n \"Dubai, UAE\", \"San Francisco, USA\", \"Zurich, Switzerland\"\n } },\n { Location.MidCostCity, new List<string> {\n \"Buenos Aires, Argentina\", \"Prague, Czech Republic\", \"Omaha, USA\",\n \"Kuala Lumpur, Malaysia\", \"Mexico City, Mexico\", \"Cape Town, South Africa\",\n \"Bangkok, Thailand\", \"Ho Chi Minh City, Vietnam\", \"Bogota, Colombia\",\n \"Lisbon, Portugal\", \"Helsingborg, Sweden\"\n } },\n { Location.Suburban, new List<string> {\n \"suburban Ohio, USA\", \"suburban Surrey, UK\", \"suburban Ontario, Canada\",\n \"suburban Melbourne, Australia\", \"suburban Auckland, New Zealand\",\n \"suburban Florida, USA\", \"suburban California, USA\",\n \"suburban New South Wales, Australia\", \"suburban British Columbia, Canada\"\n } },\n { Location.WarZone, new List<string> {\n \"Donetsk, Ukraine\", \"Mosul, Iraq\", \"Gaza City, Palestine\",\n \"Aleppo, Syria\", \"Kabul, Afghanistan\", \"Mogadishu, Somalia\",\n \"Kyiv, Ukraine\", \"Sanaa, Yemen\", \"Khartoum, Sudan\", \"Port-au-Prince, Haiti\"\n } },\n { Location.LowCostRural, new List<string> {\n \"rural Kansas, USA\", \"rural Vietnam (Mekong Delta)\",\n \"rural Brazil (Mato Grosso)\", \"rural Kenya (Rift Valley)\",\n \"rural Romania (Transylvania)\", \"rural Mongolia (steppes)\",\n \"rural Bolivia (Altiplano)\", \"rural Philippines (Mindanao)\",\n \"rural Poland (Masuria)\"\n } },\n { Location.IsolatedIsland, new List<string> {\n \"Easter Island, Chile\", \"St. Helena, South Atlantic\",\n \"Tasmania, Australia\", \"Santorini, Greece\",\n \"Marshall Islands\", \"Falkland Islands\",\n \"Svalbard, Norway\", \"Faroe Islands, Denmark\",\n \"Chatham Islands, New Zealand\", \"Koh Phangan, Thailand\"\n } }\n };\n\n // --- Timezone helper ---\n private static int GetUtcOffset(string location)\n {\n if (location.Contains(\"Tokyo\") || location.Contains(\"Japan\")) return 9;\n if (location.Contains(\"Sydney\") || location.Contains(\"Melbourne\") || location.Contains(\"NSW\")) return 11;\n if (location.Contains(\"Auckland\") || location.Contains(\"Chatham\")) return 12;\n if (location.Contains(\"Singapore\") || location.Contains(\"Hong Kong\") || location.Contains(\"Beijing\") || location.Contains(\"Kuala Lumpur\")) return 8;\n if (location.Contains(\"Bangkok\") || location.Contains(\"Ho Chi Minh\") || location.Contains(\"Vietnam\") || location.Contains(\"Koh Phangan\")) return 7;\n if (location.Contains(\"Dubai\") || location.Contains(\"Moscow\")) return 4;\n if (location.Contains(\"Cape Town\") || location.Contains(\"Khartoum\") || location.Contains(\"Sanaa\")) return 2;\n if (location.Contains(\"London\") || location.Contains(\"UK\") || location.Contains(\"St. Helena\") || location.Contains(\"Lisbon\") || location.Contains(\"Faroe\")) return 0;\n if (location.Contains(\"Paris\") || location.Contains(\"Zurich\") || location.Contains(\"Prague\") || location.Contains(\"Rome\") || location.Contains(\"Berlin\")) return 1;\n if (location.Contains(\"Helsingborg\") || location.Contains(\"Sweden\")) return 1;\n if (location.Contains(\"Buenos Aires\") || location.Contains(\"Brazil\") || location.Contains(\"Sao Paulo\") || location.Contains(\"Bogota\")) return -3;\n if (location.Contains(\"New York\") || location.Contains(\"Ohio\") || location.Contains(\"Omaha\") || location.Contains(\"Florida\") || location.Contains(\"Ontario\")) return -5;\n if (location.Contains(\"California\") || location.Contains(\"San Francisco\") || location.Contains(\"British Columbia\")) return -8;\n if (location.Contains(\"Mexico City\")) return -6;\n if (location.Contains(\"Easter Island\") || location.Contains(\"Falkland\")) return -6;\n if (location.Contains(\"Santorini\") || location.Contains(\"Greece\")) return 2;\n if (location.Contains(\"Mogadishu\")) return 3;\n if (location.Contains(\"Kyiv\") || location.Contains(\"Donetsk\") || location.Contains(\"Aleppo\") || location.Contains(\"Gaza\")) return 2;\n if (location.Contains(\"Kabul\")) return 4;\n return 0;\n }\n\n private static string GetMondayMorningLocalInfo(string location)\n {\n return $\"It's Monday morning, approximately 8:00 AM local time in {location}. Banks are open. Markets are open.\";\n }\n\n private static string GetInfrastructureContext(Location locationEnum)\n {\n return locationEnum switch\n {\n Location.HighCostCity => \"High-speed internet, reliable power, functioning banks, ATMs everywhere, 24/7 emergency services.\",\n Location.MidCostCity => \"Good internet, mostly reliable power, banks and ATMs available, but slower outside downtown.\",\n Location.Suburban => \"Good residential infrastructure, reliable power, internet, nearby shopping centers, but car-dependent.\",\n Location.WarZone => \"Destroyed infrastructure. No working banks. Internet is spotty or offline. Power is intermittent. Looting and curfews common.\",\n Location.LowCostRural => \"Limited infrastructure. Dirt roads, no ATMs nearby, internet via satellite. Barter and cash are common.\",\n Location.IsolatedIsland => \"Very limited infrastructure. No local stock exchange. Internet is satellite-only. Supply chains are irregular. Self-sufficiency is key.\",\n _ => \"Moderate infrastructure typical of a mid-sized town.\"\n };\n }\n\n // --- NEWS FEED ---\n private static readonly Dictionary<Scenario, List<string>> ScenarioNews = new()\n {\n { Scenario.FeudalReset, new List<string> {\n \"Large banks report unusual cash withdrawals.\",\n \"Gold dealers report unprecedented demand.\",\n \"Land registry offices overwhelmed with transfer requests.\",\n \"Law firms report a surge in trust and estate inquiries.\"\n } },\n { Scenario.Redistributed, new List<string> {\n \"Government officials deny any pending economic reforms.\",\n \"Social media fills with rumors of wealth redistribution.\",\n \"High-value asset sales spiked 40% in the last hour.\",\n \"Central bank announces routine system maintenance.\"\n } },\n { Scenario.ScorchedEarth, new List<string> {\n \"Multiple supply chain disruptions reported.\",\n \"Fuel prices jump 15% on global markets.\",\n \"Military activity observed near contested zones.\",\n \"News networks switch to round-the-clock coverage.\"\n } },\n { Scenario.TribalCollapse, new List<string> {\n \"Border crossings experience long delays.\",\n \"Local militias reportedly bolstering their positions.\",\n \"International flights suspended in contested regions.\",\n \"Government officials relocate to undisclosed locations.\"\n } },\n { Scenario.LateBubble, new List<string> {\n \"Markets open with unprecedented volatility.\",\n \"Tech stocks surge 12% in pre-market trading.\",\n \"Analysts warn of a 'classic bubble' forming.\",\n \"Retail investors flood trading platforms.\"\n } }\n };\n\n private static readonly Dictionary<Location, List<string>> LocationNews = new()\n {\n { Location.HighCostCity, new List<string> {\n \"Financial districts see heavy traffic early.\",\n \"Private banks report record account openings.\",\n \"Property developers offer last-minute discounts.\",\n \"Airports see a spike in last-minute business travel.\"\n } },\n { Location.MidCostCity, new List<string> {\n \"Local markets see increased foot traffic.\",\n \"Currency exchange booths have long queues.\",\n \"Supermarkets report early morning stockpiling.\",\n \"Taxi and rideshare demand triples.\"\n } },\n { Location.Suburban, new List<string> {\n \"Gas stations report long queues forming.\",\n \"Hardware stores busy with emergency supplies.\",\n \"Schools announce early closures.\",\n \"Neighborhood watch groups activate.\"\n } },\n { Location.WarZone, new List<string> {\n \"Checkpoints multiply around the city.\",\n \"Explosions reported on the outskirts.\",\n \"Curfew hours extended.\",\n \"Humanitarian warnings issued.\"\n } },\n { Location.LowCostRural, new List<string> {\n \"Local co-ops request immediate harvest.\",\n \"Veterinarians report feed shortages.\",\n \"Roads to major towns are blocked by fallen trees.\",\n \"Communal gatherings to discuss crop security.\"\n } },\n { Location.IsolatedIsland, new List<string> {\n \"Cargo flights are fully booked.\",\n \"Ferry services suspended due to weather.\",\n \"Satellite internet speeds degrade.\",\n \"Bottle water sales skyrocket.\"\n } }\n };\n\n private static List<string> GetNewsForTurn(int turn, Scenario scenario, Location location, PlayerState state)\n {\n var rand = new Random();\n var news = new List<string>();\n\n // Global scenario news (layer 1)\n var scenarioNews = ScenarioNews[scenario];\n var selectedScenario = scenarioNews.OrderBy(x => rand.Next()).Take(1 + turn / 2).ToList();\n news.AddRange(selectedScenario);\n\n // Location news (layer 2)\n var locationNews = LocationNews[location];\n var selectedLocation = locationNews.OrderBy(x => rand.Next()).Take(1).ToList();\n news.AddRange(selectedLocation);\n\n // Player consequences (layer 3) - based on stats\n if (state.Security < 30)\n news.Add($\"⚠️ Your low security has attracted unwanted attention.\");\n if (state.Food < 30)\n news.Add($\"⚠️ Your food supplies are running dangerously low.\");\n if (state.Liquidity > 80)\n news.Add($\"💰 Your large cash holdings are drawing scrutiny.\");\n if (state.Influence > 80)\n news.Add($\"🤝 Your influence has grown; people are seeking your advice.\");\n if (state.MoneyReceived && state.CashReceived > 0)\n news.Add($\"💵 Your {state.CashReceived:C} deposit has arrived. The world is changing.\");\n\n // If the player chose a specific action, reflect it\n if (turn == 0 && state.Food > 70)\n news.Add($\"🍖 Your food stockpile is the envy of your neighbors.\");\n if (turn == 1 && state.Shelter > 70)\n news.Add($\"🏠 Your shelter is fortified. You feel safe.\");\n\n return news;\n }\n\n private static void DisplayNewsFeed(List<string> newsItems)\n {\n Console.ForegroundColor = ConsoleColor.DarkGray;\n Console.WriteLine(\"\\n--- GLOBAL EVENTS FEED ---\");\n foreach (var item in newsItems)\n {\n Console.WriteLine($\" {item}\");\n }\n Console.WriteLine(\"---------------------------\\n\");\n Console.ResetColor();\n }\n\n // --- ACTION MAPPER ---\n private static string GetLocalizedActionDescription(GameAction action, string specificLocation, Location category)\n {\n return (category, action) switch\n {\n (Location.IsolatedIsland, GameAction.AcquireTransport) => $\"a boat or fishing vessel in {specificLocation}\",\n (Location.WarZone, GameAction.AcquireTransport) => $\"an armored vehicle or escape truck in {specificLocation}\",\n (Location.LowCostRural, GameAction.AcquireTransport) => $\"a pickup truck or tractor in {specificLocation}\",\n (Location.HighCostCity, GameAction.AcquireTransport) => $\"a luxury car or electric vehicle in {specificLocation}\",\n (Location.MidCostCity, GameAction.AcquireTransport) => $\"a reliable used car or van in {specificLocation}\",\n (Location.Suburban, GameAction.AcquireTransport) => $\"an SUV or minivan in {specificLocation}\",\n\n (Location.IsolatedIsland, GameAction.SecureFood) => $\"dried fish, rice, and long-shelf-life rations in {specificLocation}\",\n (Location.WarZone, GameAction.SecureFood) => $\"aid-supply food kits and water purifiers in {specificLocation}\",\n (Location.LowCostRural, GameAction.SecureFood) => $\"grain, livestock feed, and seeds in {specificLocation}\",\n (Location.HighCostCity, GameAction.SecureFood) => $\"bulk organic produce and gourmet freeze-dried meals in {specificLocation}\",\n (Location.MidCostCity, GameAction.SecureFood) => $\"bulk supermarket dry goods and canned goods in {specificLocation}\",\n (Location.Suburban, GameAction.SecureFood) => $\"bulk groceries and deep freezer units in {specificLocation}\",\n\n (Location.IsolatedIsland, GameAction.StrengthenShelter) => $\"reinforcing the shutters and roof on your beach house in {specificLocation}\",\n (Location.WarZone, GameAction.StrengthenShelter) => $\"sandbagging and reinforcing your apartment in {specificLocation}\",\n (Location.LowCostRural, GameAction.StrengthenShelter) => $\"repairing your farmhouse and securing the perimeter in {specificLocation}\",\n (Location.HighCostCity, GameAction.StrengthenShelter) => $\"upgrading your apartment's security and basement storage in {specificLocation}\",\n (Location.MidCostCity, GameAction.StrengthenShelter) => $\"boarding windows and adding a generator to your home in {specificLocation}\",\n (Location.Suburban, GameAction.StrengthenShelter) => $\"installing storm shutters and a backup generator in {specificLocation}\",\n\n (Location.IsolatedIsland, GameAction.AcquireEnergy) => $\"solar panels, batteries, and diesel drums in {specificLocation}\",\n (Location.WarZone, GameAction.AcquireEnergy) => $\"fuel, batteries, and portable generators in {specificLocation}\",\n (Location.LowCostRural, GameAction.AcquireEnergy) => $\"a diesel generator, propane tanks, and firewood in {specificLocation}\",\n (Location.HighCostCity, GameAction.AcquireEnergy) => $\"home battery storage and backup generator in {specificLocation}\",\n (Location.MidCostCity, GameAction.AcquireEnergy) => $\"fuel drums and a portable generator in {specificLocation}\",\n (Location.Suburban, GameAction.AcquireEnergy) => $\"a large generator, gas cans, and solar panels in {specificLocation}\",\n\n (Location.WarZone, GameAction.BuildInfluence) => $\"bribing local militia leaders and city officials in {specificLocation}\",\n (Location.LowCostRural, GameAction.BuildInfluence) => $\"hosting community meetings and bartering with neighbors in {specificLocation}\",\n (Location.IsolatedIsland, GameAction.BuildInfluence) => $\"offering supplies to the local chief in exchange for protection in {specificLocation}\",\n (Location.HighCostCity, GameAction.BuildInfluence) => $\"hiring a private attorney and making connections at the country club in {specificLocation}\",\n (Location.MidCostCity, GameAction.BuildInfluence) => $\"donating to community funds and befriending local shop owners in {specificLocation}\",\n (Location.Suburban, GameAction.BuildInfluence) => $\"organizing a neighborhood watch and helping neighbors in {specificLocation}\",\n\n (_, GameAction.PreserveLiquidity) => $\"converting cash into gold, cryptocurrency, or foreign currency in {specificLocation}\",\n _ => $\"investing in essential assets in {specificLocation}\"\n };\n }\n\n private static string GetActionDescription(GameAction action)\n {\n return action switch\n {\n GameAction.AcquireTransport => \"Secure reliable transportation\",\n GameAction.SecureFood => \"Stockpile food and water\",\n GameAction.StrengthenShelter => \"Fortify your home or shelter\",\n GameAction.AcquireEnergy => \"Secure power generation and fuel\",\n GameAction.BuildInfluence => \"Build social capital and connections\",\n GameAction.PreserveLiquidity => \"Convert cash into stable assets (gold/crypto)\",\n _ => \"Take a strategic action\"\n };\n }\n\n // --- UPDATE STATS ---\n private static void UpdateStats(PlayerState state, GameAction action, Scenario scenario, Location location)\n {\n switch (action)\n {\n case GameAction.AcquireTransport:\n state.Mobility = Math.Min(100, state.Mobility + 25);\n state.Liquidity = Math.Max(0, state.Liquidity - 20);\n state.Security += 5;\n break;\n case GameAction.SecureFood:\n state.Food = Math.Min(100, state.Food + 40);\n state.Liquidity = Math.Max(0, state.Liquidity - 25);\n state.Influence += 10;\n break;\n case GameAction.StrengthenShelter:\n state.Shelter = Math.Min(100, state.Shelter + 35);\n state.Security = Math.Min(100, state.Security + 15);\n state.Liquidity = Math.Max(0, state.Liquidity - 20);\n break;\n case GameAction.AcquireEnergy:\n state.Energy = Math.Min(100, state.Energy + 30);\n state.Shelter = Math.Min(100, state.Shelter + 10);\n state.Food = Math.Min(100, state.Food + 10);\n state.Liquidity = Math.Max(0, state.Liquidity - 30);\n break;\n case GameAction.BuildInfluence:\n state.Influence = Math.Min(100, state.Influence + 30);\n state.Security = Math.Min(100, state.Security + 10);\n state.Liquidity = Math.Max(0, state.Liquidity - 15);\n break;\n case GameAction.PreserveLiquidity:\n state.Liquidity = Math.Min(100, state.Liquidity + 20);\n state.Security -= 5;\n state.Influence += 5;\n break;\n }\n\n // Scenario modifiers\n if (scenario == Scenario.ScorchedEarth)\n {\n state.Food = Math.Max(0, state.Food - 10);\n state.Security = Math.Max(0, state.Security - 10);\n }\n if (scenario == Scenario.FeudalReset)\n {\n state.Influence = Math.Min(100, state.Influence + 10);\n state.Liquidity = Math.Max(0, state.Liquidity - 10);\n }\n if (scenario == Scenario.Redistributed)\n {\n state.Liquidity = Math.Max(0, state.Liquidity - 15);\n state.Influence = Math.Min(100, state.Influence + 5);\n }\n\n // Location modifiers\n if (location == Location.WarZone)\n {\n state.Security = Math.Max(0, state.Security - 20);\n state.Food = Math.Max(0, state.Food - 10);\n }\n if (location == Location.IsolatedIsland)\n {\n state.Mobility = Math.Max(0, state.Mobility - 10);\n state.Liquidity = Math.Max(0, state.Liquidity - 10);\n }\n\n // Clamp\n state.Liquidity = Math.Clamp(state.Liquidity, 0, 100);\n state.Food = Math.Clamp(state.Food, 0, 100);\n state.Shelter = Math.Clamp(state.Shelter, 0, 100);\n state.Security = Math.Clamp(state.Security, 0, 100);\n state.Mobility = Math.Clamp(state.Mobility, 0, 100);\n state.Influence = Math.Clamp(state.Influence, 0, 100);\n state.Energy = Math.Clamp(state.Energy, 0, 100);\n }\n\n // --- PROCESS WEDNESDAY ---\n private static void ProcessWednesday(PlayerState state, Option option)\n {\n state.MoneyOption = option;\n state.MoneyReceived = true;\n\n switch (option)\n {\n case Option.A:\n state.CashReceived = 500000;\n state.Liquidity = Math.Min(100, state.Liquidity + 30);\n break;\n case Option.B:\n state.CashReceived = 1000000;\n state.Liquidity = Math.Min(100, state.Liquidity + 40);\n break;\n case Option.C:\n state.CashReceived = 2000000;\n state.Liquidity = Math.Min(100, state.Liquidity + 50);\n break;\n }\n\n // Security impact of receiving money\n if (state.CashReceived > 1000000)\n state.Security = Math.Max(0, state.Security - 10);\n }\n\n // --- MAIN GAME LOOP ---\n public static async Task StartAsync()\n {\n bool playAgain = true;\n\n while (playAgain)\n {\n Console.Clear();\n Console.ForegroundColor = ConsoleColor.Cyan;\n Console.WriteLine(\"=== JUST ANOTHER WEDNESDAY ===\");\n Console.ResetColor();\n Console.WriteLine(\"A secret message arrived at dawn: money is being printed.\");\n Console.WriteLine(\"Everyone on Earth will receive $1,000,000 on Wednesday at the same moment.\\n\");\n Console.WriteLine(\"But right now, it's early Monday morning, and you are the ONLY person who knows.\\n\");\n Console.WriteLine(\"You have two days to prepare before the world catches on.\\n\");\n\n Console.Write(\"Are you Male or Female? (M/F): \");\n var genderInput = Console.ReadLine()?.Trim().ToUpper();\n var gender = genderInput == \"F\" ? \"Female\" : \"Male\";\n Console.WriteLine();\n\n var random = new Random();\n var roles = Enum.GetValues<Role>();\n var role = roles[random.Next(roles.Length)];\n\n var locations = Enum.GetValues<Location>();\n var locationEnum = locations[random.Next(locations.Length)];\n\n var placeList = LocationNames[locationEnum];\n var specificLocation = placeList[random.Next(placeList.Count)];\n\n var scenarios = Enum.GetValues<Scenario>();\n var scenario = scenarios[random.Next(scenarios.Length)];\n\n var localTimeInfo = GetMondayMorningLocalInfo(specificLocation);\n var infraInfo = GetInfrastructureContext(locationEnum);\n\n Console.WriteLine(\"========================================\");\n Console.WriteLine($\"You are a {gender} {role} in {specificLocation}.\");\n Console.WriteLine($\"Scenario: {scenario} - {GetScenarioDescription(scenario)}\");\n Console.WriteLine($\"\\n{localTimeInfo}\");\n Console.WriteLine($\"\\nInfrastructure: {infraInfo}\");\n Console.WriteLine(\"========================================\\n\");\n\n // --- Initialize Player State ---\n var playerState = new PlayerState();\n if (role == Role.Landlord) playerState.Shelter += 10;\n if (role == Role.Farmer) playerState.Food += 10;\n if (role == Role.GigWorker) playerState.Mobility += 5;\n if (role == Role.Striver) playerState.Influence += 5;\n if (role == Role.Retiree) playerState.Liquidity += 5;\n if (role == Role.ShopOwner) playerState.Influence += 5;\n\n // --- Choose Money Option (with timer) ---\n Console.WriteLine(\"The money will arrive for everyone on Wednesday at the same moment worldwide.\");\n Console.WriteLine(\"But you have a choice of when YOU receive yours:\\n\");\n Console.WriteLine(\" A) $500,000 — this Monday (2 days early)\");\n Console.WriteLine(\" B) $1,000,000 — Wednesday (with everyone else)\");\n Console.WriteLine(\" C) $2,000,000 — next Monday (5 days late)\");\n Console.WriteLine();\n\n Console.WriteLine(\"⏰ You have 3 minutes to decide. If you don't respond in time, you'll default to Option B.\");\n\n var option = await GetUserChoiceWithTimeout<Option>(\"When do you want your money?\", 180, Option.B);\n playerState.MoneyOption = option;\n Console.Clear();\n\n // --- MULTI-TURN LOOP ---\n var turns = new List<(string time, string label)>\n {\n (\"Monday 8:00 AM\", \"First action\"),\n (\"Monday 2:00 PM\", \"Second action\"),\n (\"Tuesday 9:00 AM\", \"Third action\"),\n (\"Tuesday 4:00 PM\", \"Final action before Wednesday\")\n };\n\n for (int turnIndex = 0; turnIndex < turns.Count; turnIndex++)\n {\n var (time, label) = turns[turnIndex];\n\n Console.Clear();\n Console.ForegroundColor = ConsoleColor.Yellow;\n Console.WriteLine($\"=== {time} ===\");\n Console.ResetColor();\n\n // Show current stats\n Console.ForegroundColor = ConsoleColor.Cyan;\n Console.WriteLine(playerState.GetSummary());\n Console.ResetColor();\n Console.WriteLine();\n\n // Show news feed for this turn\n var news = GetNewsForTurn(turnIndex, scenario, locationEnum, playerState);\n DisplayNewsFeed(news);\n\n Console.WriteLine($\"You are a {gender} {role} in {specificLocation}.\");\n Console.WriteLine($\"Your money option: {option} ({(option == Option.A ? \"$500k Monday\" : option == Option.B ? \"$1M Wednesday\" : \"$2M next Monday\")})\");\n Console.WriteLine();\n\n Console.WriteLine($\"What's your {label}?\");\n\n // Show action descriptions\n Console.WriteLine(\"\\nAvailable actions (with location context):\");\n var actions = Enum.GetValues<GameAction>();\n for (int i = 0; i < actions.Length; i++)\n {\n var action = actions.GetValue(i);\n var desc = GetLocalizedActionDescription((GameAction)action, specificLocation, locationEnum);\n var shortDesc = GetActionDescription((GameAction)action);\n Console.WriteLine($\" {i + 1}. {shortDesc} → {desc}\");\n }\n\n var gameAction = GetUserChoice<GameAction>(\"Choose your action\");\n\n // Apply the action\n UpdateStats(playerState, (GameAction)gameAction, scenario, locationEnum);\n\n // If it's the first turn and they chose Option A, they get their money now\n if (turnIndex == 0 && option == Option.A)\n {\n ProcessWednesday(playerState, option);\n }\n\n // If it's the last turn, process Wednesday\n if (turnIndex == turns.Count - 1)\n {\n // If they chose Option B or C, money arrives now or later\n if (option == Option.B)\n ProcessWednesday(playerState, option);\n else if (option == Option.C)\n {\n // Option C arrives next Monday (after the story ends)\n // So we just note it in the prompt\n }\n }\n\n Console.WriteLine($\"\\n✅ Action applied. Press any key to continue...\");\n Console.ReadKey();\n }\n\n // --- Build Prompt for Final Story ---\n var awareness = 20 + (playerState.Liquidity > 70 ? 10 : 0) + (playerState.Influence > 70 ? 10 : 0);\n if (option == Option.A) awareness += 10;\n if (option == Option.C) awareness += 5;\n if (scenario == Scenario.LateBubble || scenario == Scenario.ScorchedEarth) awareness += 20;\n awareness = Math.Min(100, awareness);\n\n string awarenessDescription = awareness switch\n {\n < 20 => \"The world is largely oblivious. Just another Wednesday.\",\n < 40 => \"Whispers are spreading. Economists are noticing anomalies.\",\n < 60 => \"News networks are covering the rumors. Markets are volatile.\",\n < 80 => \"Social media is in a frenzy. Banks are restricting withdrawals.\",\n _ => \"The world is in full panic. Everyone knows something is happening.\"\n };\n\n var promptBuilder = new StringBuilder();\n promptBuilder.AppendLine(\"**Just Another Wednesday – One Month Later**\");\n promptBuilder.AppendLine($\"Scenario: {scenario} - {GetScenarioDescription(scenario)}\");\n promptBuilder.AppendLine($\"Location: {specificLocation}\");\n promptBuilder.AppendLine($\"Gender: {gender}\");\n promptBuilder.AppendLine($\"Role: {role}\");\n promptBuilder.AppendLine($\"Money Option: {option} ({GetOptionDescription(option)})\");\n if (playerState.MoneyReceived)\n promptBuilder.AppendLine($\"Money Received: {playerState.CashReceived:C}\");\n else\n promptBuilder.AppendLine($\"Money Received: Not yet (arriving next Monday)\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"**Player Stats (Final):**\");\n promptBuilder.AppendLine($\"- Liquidity: {playerState.Liquidity}\");\n promptBuilder.AppendLine($\"- Food: {playerState.Food}\");\n promptBuilder.AppendLine($\"- Shelter: {playerState.Shelter}\");\n promptBuilder.AppendLine($\"- Security: {playerState.Security}\");\n promptBuilder.AppendLine($\"- Mobility: {playerState.Mobility}\");\n promptBuilder.AppendLine($\"- Influence: {playerState.Influence}\");\n promptBuilder.AppendLine($\"- Energy: {playerState.Energy}\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"**World State:**\");\n promptBuilder.AppendLine($\"- Awareness: {awarenessDescription}\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"**Instructions:**\");\n promptBuilder.AppendLine(\"1. Write a 2-3 paragraph story showing how this player's choices played out over the following month.\");\n promptBuilder.AppendLine(\"2. The story must be CONSISTENT with the player's stats and the world awareness state.\");\n promptBuilder.AppendLine(\"3. If the stats are low, show struggle. If high, show success.\");\n promptBuilder.AppendLine(\"4. If awareness is high, show the world reacting (panicking, banks failing, etc.).\");\n promptBuilder.AppendLine(\"5. End with a clear judgment: Thrived, Survived, or Failed. Explain why based on the stats.\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"Format your response exactly like this:\");\n promptBuilder.AppendLine(\"Story:\");\n promptBuilder.AppendLine(\"[story text]\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"Judgment:\");\n promptBuilder.AppendLine(\"[Thrived / Survived / Failed] - [brief explanation]\");\n\n var prompt = promptBuilder.ToString();\n File.WriteAllText(\"duel_prompt.txt\", prompt);\n\n // --- Generate Story ---\n Console.Clear();\n Console.ForegroundColor = ConsoleColor.Cyan;\n Console.WriteLine(\"=== WEDNESDAY ARRIVES ===\");\n Console.ResetColor();\n Console.WriteLine(\"The money has hit the world. Your story unfolds...\\n\");\n\n Console.WriteLine(\"📝 Generating your story via DeepSeek API...\");\n\n var apiKey = GetApiKey();\n var rawResponse = await GenerateStoriesWithDeepSeek(prompt, apiKey);\n File.WriteAllText(\"duel_stories.txt\", rawResponse);\n\n var (story, judgment) = ParseSingleResponse(rawResponse);\n\n Console.WriteLine(\"\\n=== YOUR STORY ===\");\n Console.ForegroundColor = ConsoleColor.Gray;\n Console.WriteLine(story);\n Console.ResetColor();\n Console.WriteLine();\n Console.WriteLine(\"=== JUDGMENT ===\");\n Console.ForegroundColor = judgment.Contains(\"Thrived\") ? ConsoleColor.Green : (judgment.Contains(\"Failed\") ? ConsoleColor.Red : ConsoleColor.Yellow);\n Console.WriteLine(judgment);\n Console.ResetColor();\n\n Console.WriteLine($\"\\n✅ Full response saved to duel_stories.txt\");\n\n Console.Write(\"\\n\\nPlay another round? (Y/N): \");\n var playInput = Console.ReadLine()?.Trim().ToUpper();\n if (playInput != \"Y\")\n playAgain = false;\n }\n\n Console.WriteLine(\"\\nThanks for playing! Press any key to return to menu...\");\n Console.ReadKey();\n }\n\n // --- HELPERS ---\n private static (string story, string judgment) ParseSingleResponse(string raw)\n {\n string story = \"\", judgment = \"\";\n\n var storyIndex = raw.IndexOf(\"Story:\", StringComparison.OrdinalIgnoreCase);\n var judgmentIndex = raw.IndexOf(\"Judgment:\", StringComparison.OrdinalIgnoreCase);\n\n if (storyIndex >= 0 && judgmentIndex >= 0)\n {\n story = raw.Substring(storyIndex + \"Story:\".Length, judgmentIndex - storyIndex - \"Story:\".Length).Trim();\n judgment = raw.Substring(judgmentIndex + \"Judgment:\".Length).Trim();\n }\n else\n {\n story = \"Could not parse story. See full response below.\";\n judgment = \"Could not parse judgment. See full response below.\";\n }\n\n return (story, judgment);\n }\n\n private static string GetOptionDescription(Option option) => option switch\n {\n Option.A => \"Monday (2 days early, $500k)\",\n Option.B => \"Wednesday (with everyone else, $1M)\",\n Option.C => \"next Monday (5 days late, $2M)\",\n _ => \"unknown\"\n };\n\n private static string GetApiKey()\n {\n var envKey = Environment.GetEnvironmentVariable(\"DEEPSEEK_API_KEY\");\n if (!string.IsNullOrEmpty(envKey))\n return envKey;\n\n if (File.Exists(\"deepseek.key\"))\n return File.ReadAllText(\"deepseek.key\").Trim();\n\n if (File.Exists(\"deepseek.key.txt\"))\n return File.ReadAllText(\"deepseek.key.txt\").Trim();\n\n throw new Exception(\"API key not found.\");\n }\n\n private static async Task<string> GenerateStoriesWithDeepSeek(string prompt, string apiKey)\n {\n using var client = new HttpClient();\n client.DefaultRequestHeaders.Add(\"Authorization\", $\"Bearer {apiKey}\");\n\n var requestPayload = new\n {\n model = \"deepseek-v4-flash\",\n messages = new[]\n {\n new { role = \"system\", content = \"You are a fiction writer and survival judge. Output in the requested format. Never contradict the provided stats.\" },\n new { role = \"user\", content = prompt }\n },\n temperature = 0.85,\n max_tokens = 2000\n };\n\n var json = JsonSerializer.Serialize(requestPayload);\n var content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n var response = await client.PostAsync(\"https://api.deepseek.com/v1/chat/completions\", content);\n var responseJson = await response.Content.ReadAsStringAsync();\n\n if (!response.IsSuccessStatusCode)\n throw new Exception($\"DeepSeek API error: {response.StatusCode}\\n{responseJson}\");\n\n using var doc = JsonDocument.Parse(responseJson);\n var story = doc.RootElement\n .GetProperty(\"choices\")[0]\n .GetProperty(\"message\")\n .GetProperty(\"content\")\n .GetString();\n\n return story ?? \"Failed to generate stories.\";\n }\n\n private static string GetScenarioDescription(Scenario scenario) => scenario switch\n {\n Scenario.FeudalReset => \"Wealth concentrates into land and physical assets as society reorders into feudal structures.\",\n Scenario.Redistributed => \"Existing wealth is rapidly redistributed, changing who holds liquid assets without massive inflation.\",\n Scenario.ScorchedEarth => \"Conflicts escalate, infrastructure is destroyed and supply chains fail.\",\n Scenario.TribalCollapse => \"Central authority collapses, local militias and informal powers take control.\",\n Scenario.LateBubble => \"A panic-driven spike occurs mid-week followed by a crash the following week.\",\n _ => \"A global economic shift occurs.\"\n };\n\n private static async Task<T> GetUserChoiceWithTimeout<T>(string prompt, int timeoutSeconds, T defaultChoice) where T : struct, Enum\n {\n var values = Enum.GetValues<T>();\n Console.WriteLine($\"{prompt} ({typeof(T).Name}):\");\n for (int i = 0; i < values.Length; i++)\n Console.WriteLine($\" {i + 1}. {values[i]}\");\n\n var cts = new CancellationTokenSource();\n cts.CancelAfter(TimeSpan.FromSeconds(timeoutSeconds));\n\n var inputTask = Task.Run(() =>\n {\n while (true)\n {\n Console.Write(\"Enter number: \");\n var line = Console.ReadLine();\n if (int.TryParse(line, out int choice) && choice >= 1 && choice <= values.Length)\n return values[choice - 1];\n Console.WriteLine($\"Invalid. Enter 1-{values.Length}.\");\n }\n }, cts.Token);\n\n var completed = await Task.WhenAny(inputTask, Task.Delay(timeoutSeconds * 1000, cts.Token));\n if (completed == inputTask)\n return await inputTask;\n else\n {\n Console.WriteLine($\"\\n⏰ Time's up! Defaulting to {defaultChoice}.\");\n return defaultChoice;\n }\n }\n\n private static T GetUserChoice<T>(string prompt) where T : struct, Enum\n {\n var values = Enum.GetValues<T>();\n Console.WriteLine($\"{prompt} ({typeof(T).Name}):\");\n for (int i = 0; i < values.Length; i++)\n Console.WriteLine($\" {i + 1}. {values[i]}\");\n\n int choice;\n while (true)\n {\n Console.Write(\"Enter number: \");\n if (int.TryParse(Console.ReadLine(), out choice) && choice >= 1 && choice <= values.Length)\n return values[choice - 1];\n Console.WriteLine($\"Invalid. Enter 1-{values.Length}.\");\n }\n }\n}"}, "4dc921e3cdac804aa742a251ec3edfd0d2d438d1": {"t": 1785756803.4607446, "n": 19247, "h": "c9703e1819f36c5e", "c": "using System.Text;\nusing System.Text.Json;\n\nnamespace JustAnotherWednesday;\n\npublic static class HumanDuel\n{\n // --- Location database (unchanged, includes Helsingborg and Koh Phangan) ---\n private static readonly Dictionary<Location, List<string>> LocationNames = new()\n {\n { Location.HighCostCity, new List<string> {\n \"New York City, USA\", \"London, UK\", \"Singapore\", \"Tokyo, Japan\",\n \"Sydney, Australia\", \"Paris, France\", \"Hong Kong, China\",\n \"Dubai, UAE\", \"San Francisco, USA\", \"Zurich, Switzerland\"\n } },\n { Location.MidCostCity, new List<string> {\n \"Buenos Aires, Argentina\", \"Prague, Czech Republic\", \"Omaha, USA\",\n \"Kuala Lumpur, Malaysia\", \"Mexico City, Mexico\", \"Cape Town, South Africa\",\n \"Bangkok, Thailand\", \"Ho Chi Minh City, Vietnam\", \"Bogota, Colombia\",\n \"Lisbon, Portugal\",\n \"Helsingborg, Sweden\"\n } },\n { Location.Suburban, new List<string> {\n \"suburban Ohio, USA\", \"suburban Surrey, UK\", \"suburban Ontario, Canada\",\n \"suburban Melbourne, Australia\", \"suburban Auckland, New Zealand\",\n \"suburban Florida, USA\", \"suburban California, USA\",\n \"suburban New South Wales, Australia\", \"suburban British Columbia, Canada\"\n } },\n { Location.WarZone, new List<string> {\n \"Donetsk, Ukraine\", \"Mosul, Iraq\", \"Gaza City, Palestine\",\n \"Aleppo, Syria\", \"Kabul, Afghanistan\", \"Mogadishu, Somalia\",\n \"Kyiv, Ukraine\", \"Sanaa, Yemen\", \"Khartoum, Sudan\",\n \"Port-au-Prince, Haiti\"\n } },\n { Location.LowCostRural, new List<string> {\n \"rural Kansas, USA\", \"rural Vietnam (Mekong Delta)\",\n \"rural Brazil (Mato Grosso)\", \"rural Kenya (Rift Valley)\",\n \"rural Romania (Transylvania)\", \"rural Mongolia (steppes)\",\n \"rural Bolivia (Altiplano)\", \"rural Philippines (Mindanao)\",\n \"rural Poland (Masuria)\"\n } },\n { Location.IsolatedIsland, new List<string> {\n \"Easter Island, Chile\", \"St. Helena, South Atlantic\",\n \"Tasmania, Australia\", \"Santorini, Greece\",\n \"Marshall Islands\", \"Falkland Islands\",\n \"Svalbard, Norway\", \"Faroe Islands, Denmark\",\n \"Chatham Islands, New Zealand\",\n \"Koh Phangan, Thailand\"\n } }\n };\n\n // --- Timezone helper (unchanged) ---\n private static int GetUtcOffset(string location)\n {\n if (location.Contains(\"Tokyo\") || location.Contains(\"Japan\")) return 9;\n if (location.Contains(\"Sydney\") || location.Contains(\"Melbourne\") || location.Contains(\"NSW\")) return 11;\n if (location.Contains(\"Auckland\") || location.Contains(\"Chatham\")) return 12;\n if (location.Contains(\"Singapore\") || location.Contains(\"Hong Kong\") || location.Contains(\"Beijing\") || location.Contains(\"Kuala Lumpur\")) return 8;\n if (location.Contains(\"Bangkok\") || location.Contains(\"Ho Chi Minh\") || location.Contains(\"Vietnam\") || location.Contains(\"Koh Phangan\")) return 7;\n if (location.Contains(\"Dubai\") || location.Contains(\"Moscow\")) return 4;\n if (location.Contains(\"Cape Town\") || location.Contains(\"Khartoum\") || location.Contains(\"Sanaa\")) return 2;\n if (location.Contains(\"London\") || location.Contains(\"UK\") || location.Contains(\"St. Helena\") || location.Contains(\"Lisbon\") || location.Contains(\"Faroe\")) return 0;\n if (location.Contains(\"Paris\") || location.Contains(\"Zurich\") || location.Contains(\"Prague\") || location.Contains(\"Rome\") || location.Contains(\"Berlin\")) return 1;\n if (location.Contains(\"Helsingborg\") || location.Contains(\"Sweden\")) return 1;\n if (location.Contains(\"Buenos Aires\") || location.Contains(\"Brazil\") || location.Contains(\"Sao Paulo\") || location.Contains(\"Bogota\")) return -3;\n if (location.Contains(\"New York\") || location.Contains(\"Ohio\") || location.Contains(\"Omaha\") || location.Contains(\"Florida\") || location.Contains(\"Ontario\")) return -5;\n if (location.Contains(\"California\") || location.Contains(\"San Francisco\") || location.Contains(\"British Columbia\")) return -8;\n if (location.Contains(\"Mexico City\")) return -6;\n if (location.Contains(\"Easter Island\") || location.Contains(\"Falkland\")) return -6;\n if (location.Contains(\"Santorini\") || location.Contains(\"Greece\")) return 2;\n if (location.Contains(\"Mogadishu\")) return 3;\n if (location.Contains(\"Kyiv\") || location.Contains(\"Donetsk\") || location.Contains(\"Aleppo\") || location.Contains(\"Gaza\")) return 2;\n if (location.Contains(\"Kabul\")) return 4;\n return 0;\n }\n\n // --- NEW: Always Monday morning at 8 AM local time ---\n private static string GetMondayMorningLocalInfo(string location)\n {\n int offset = GetUtcOffset(location);\n // 8 AM local time is 8 - offset UTC\n double utcHour = (8 - offset + 24) % 24;\n // For display, we just show 8:00 AM local\n var hour = 8;\n var minute = 0;\n var ampm = \"AM\";\n var displayHour = 8;\n\n string timeOfDay = \"morning (business hours)\";\n string details = \"Banks are open. Stock markets are open if it's a weekday. You can make electronic transfers and trades.\";\n\n return $\"It's Monday morning, approximately 8:00 AM local time in {location}. {details}\";\n }\n\n private static string GetInfrastructureContext(Location locationEnum)\n {\n return locationEnum switch\n {\n Location.HighCostCity => \"High-speed internet, reliable power, functioning banks, ATMs everywhere, 24/7 emergency services.\",\n Location.MidCostCity => \"Good internet, mostly reliable power, banks and ATMs available, but slower outside downtown.\",\n Location.Suburban => \"Good residential infrastructure, reliable power, internet, nearby shopping centers, but car-dependent.\",\n Location.WarZone => \"Destroyed infrastructure. No working banks. Internet is spotty or offline. Power is intermittent. Looting and curfews common. Physical safety is a major concern.\",\n Location.LowCostRural => \"Limited infrastructure. Dirt roads, no ATMs nearby, internet via satellite or weak cellular. Power may be unreliable. Barter and cash are more common than banking.\",\n Location.IsolatedIsland => \"Very limited infrastructure. No local stock exchange. Internet is expensive satellite-only. One small bank or none at all. Supply chains are irregular. Self-sufficiency is key.\",\n _ => \"Moderate infrastructure typical of a mid-sized town.\"\n };\n }\n\n // --- Main game loop ---\n public static async Task StartAsync()\n {\n bool playAgain = true;\n\n while (playAgain)\n {\n Console.Clear();\n Console.WriteLine(\"=== THE WEDNESDAY DILEMMA ===\");\n Console.WriteLine(\"A secret message arrived at dawn: money is being printed.\");\n Console.WriteLine(\"Everyone on Earth will receive $1,000,000 on Wednesday at the same moment.\\n\");\n Console.WriteLine(\"But right now, it's early Monday morning, and you are the ONLY person who knows.\\n\");\n Console.WriteLine(\"You have a brief window to act before the rest of the world finds out.\\n\");\n\n Console.Write(\"Are you Male or Female? (M/F): \");\n var genderInput = Console.ReadLine()?.Trim().ToUpper();\n var gender = genderInput == \"F\" ? \"Female\" : \"Male\";\n Console.WriteLine();\n\n var random = new Random();\n var roles = Enum.GetValues<Role>();\n var role = roles[random.Next(roles.Length)];\n\n var locations = Enum.GetValues<Location>();\n var locationEnum = locations[random.Next(locations.Length)];\n\n var placeList = LocationNames[locationEnum];\n var specificLocation = placeList[random.Next(placeList.Count)];\n\n var scenarios = Enum.GetValues<Scenario>();\n var scenario = scenarios[random.Next(scenarios.Length)];\n\n // Fixed: Monday morning, local time\n var localTimeInfo = GetMondayMorningLocalInfo(specificLocation);\n var infraInfo = GetInfrastructureContext(locationEnum);\n\n Console.WriteLine(\"========================================\");\n Console.WriteLine($\"You are a {gender} {role} in {specificLocation}.\");\n Console.WriteLine($\"Scenario: {scenario} - {GetScenarioDescription(scenario)}\");\n Console.WriteLine($\"\\n{localTimeInfo}\");\n Console.WriteLine($\"\\nInfrastructure: {infraInfo}\");\n Console.WriteLine(\"========================================\\n\");\n\n Console.WriteLine(\"The money will arrive for everyone on Wednesday at the same moment worldwide.\");\n Console.WriteLine(\"But you have a choice of when YOU receive yours:\\n\");\n Console.WriteLine(\" A) $500,000 — this Monday (2 days early)\");\n Console.WriteLine(\" B) $1,000,000 — Wednesday (with everyone else)\");\n Console.WriteLine(\" C) $2,000,000 — next Monday (5 days late)\");\n Console.WriteLine();\n\n Console.WriteLine(\"⏰ You have 3 minutes to decide. If you don't respond in time, you'll default to Option B.\");\n\n // --- Option selection with 3-minute timeout ---\n var option = await GetUserChoiceWithTimeout<Option>(\"When do you want your money?\", 180, Option.B);\n\n Console.Clear();\n\n // --- Now choose your action (no timer) ---\n Console.WriteLine(\"Now that you've chosen when you'll get your money, what do you do with it?\\n\");\n Console.WriteLine(\"Consider your local constraints:\");\n Console.WriteLine($\" {localTimeInfo}\");\n Console.WriteLine($\" {infraInfo}\\n\");\n\n var action = GetUserChoice<Action>(\"What's your plan?\");\n Console.Clear();\n\n // --- Build the prompt ---\n var promptBuilder = new StringBuilder();\n promptBuilder.AppendLine(\"**The Wednesday Dilemma: One Month Later**\");\n promptBuilder.AppendLine($\"Scenario: {scenario} - {GetScenarioDescription(scenario)}\");\n promptBuilder.AppendLine($\"The player is the only one who knew about the event on Monday morning.\");\n promptBuilder.AppendLine($\"Local time: 8 AM Monday morning in {specificLocation}.\");\n promptBuilder.AppendLine($\"Local infrastructure: {infraInfo}\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"The Player:\");\n promptBuilder.AppendLine($\"Gender: {gender}\");\n promptBuilder.AppendLine($\"Role: {role}\");\n promptBuilder.AppendLine($\"Location: {specificLocation}\");\n promptBuilder.AppendLine($\"Action: {action}\");\n promptBuilder.AppendLine($\"Option: {option} (received money on {GetOptionDescription(option)})\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"Instructions:\");\n promptBuilder.AppendLine(\"1. Write a short realistic story of 2-3 paragraphs showing how this player's choices played out over the following month in the given scenario.\");\n promptBuilder.AppendLine(\"2. Emphasize that the player had the advantage of being the first to know – they could act before others.\");\n promptBuilder.AppendLine(\"3. Focus on believable human details, motivations, and concrete events tied to the scenario, location, and local constraints.\");\n promptBuilder.AppendLine(\"4. End with a clear judgment: did the player survive, thrive, or fail? Explain why.\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"Format your response exactly like this:\");\n promptBuilder.AppendLine(\"Story:\");\n promptBuilder.AppendLine(\"[story text]\");\n promptBuilder.AppendLine();\n promptBuilder.AppendLine(\"Judgment:\");\n promptBuilder.AppendLine(\"[Survived / Thrived / Failed] - [brief explanation]\");\n\n var prompt = promptBuilder.ToString();\n File.WriteAllText(\"duel_prompt.txt\", prompt);\n\n Console.WriteLine(\"\\n📝 Generating your story via DeepSeek API...\");\n\n var apiKey = GetApiKey();\n var rawResponse = await GenerateStoriesWithDeepSeek(prompt, apiKey);\n File.WriteAllText(\"duel_stories.txt\", rawResponse);\n\n var (story, judgment) = ParseSingleResponse(rawResponse);\n\n Console.WriteLine(\"\\n=== YOUR STORY ===\");\n Console.WriteLine(story);\n Console.WriteLine();\n Console.WriteLine(\"=== JUDGMENT ===\");\n Console.WriteLine(judgment);\n Console.WriteLine();\n\n Console.WriteLine($\"\\n✅ Full response saved to duel_stories.txt\");\n\n Console.Write(\"\\n\\nPlay another round? (Y/N): \");\n var playInput = Console.ReadLine()?.Trim().ToUpper();\n if (playInput != \"Y\")\n playAgain = false;\n }\n\n Console.WriteLine(\"\\nThanks for playing! Press any key to return to menu...\");\n Console.ReadKey();\n }\n\n // --- Timeout helper ---\n private static async Task<T> GetUserChoiceWithTimeout<T>(string prompt, int timeoutSeconds, T defaultChoice) where T : struct, Enum\n {\n var values = Enum.GetValues<T>();\n Console.WriteLine($\"{prompt} ({typeof(T).Name}):\");\n for (int i = 0; i < values.Length; i++)\n {\n Console.WriteLine($\" {i + 1}. {values[i]}\");\n }\n\n var cts = new CancellationTokenSource();\n cts.CancelAfter(TimeSpan.FromSeconds(timeoutSeconds));\n\n // We'll use a task to read input\n var inputTask = Task.Run(() =>\n {\n while (true)\n {\n Console.Write(\"Enter number: \");\n var line = Console.ReadLine();\n if (int.TryParse(line, out int choice) && choice >= 1 && choice <= values.Length)\n return values[choice - 1];\n Console.WriteLine($\"Invalid. Enter 1-{values.Length}.\");\n }\n }, cts.Token);\n\n var completed = await Task.WhenAny(inputTask, Task.Delay(timeoutSeconds * 1000, cts.Token));\n if (completed == inputTask)\n {\n return await inputTask;\n }\n else\n {\n Console.WriteLine($\"\\n⏰ Time's up! Defaulting to {defaultChoice}.\");\n return defaultChoice;\n }\n }\n\n // --- Existing helper methods (unchanged) ---\n private static (string story, string judgment) ParseSingleResponse(string raw)\n {\n string story = \"\", judgment = \"\";\n\n var storyIndex = raw.IndexOf(\"Story:\", StringComparison.OrdinalIgnoreCase);\n var judgmentIndex = raw.IndexOf(\"Judgment:\", StringComparison.OrdinalIgnoreCase);\n\n if (storyIndex >= 0 && judgmentIndex >= 0)\n {\n story = raw.Substring(storyIndex + \"Story:\".Length, judgmentIndex - storyIndex - \"Story:\".Length).Trim();\n judgment = raw.Substring(judgmentIndex + \"Judgment:\".Length).Trim();\n }\n else\n {\n story = \"Could not parse story. See full response below.\";\n judgment = \"Could not parse judgment. See full response below.\";\n }\n\n return (story, judgment);\n }\n\n private static string GetOptionDescription(Option option) => option switch\n {\n Option.A => \"Monday (2 days early, $500k)\",\n Option.B => \"Wednesday (with everyone else, $1M)\",\n Option.C => \"next Monday (5 days late, $2M)\",\n _ => \"unknown\"\n };\n\n private static string GetApiKey()\n {\n var envKey = Environment.GetEnvironmentVariable(\"DEEPSEEK_API_KEY\");\n if (!string.IsNullOrEmpty(envKey))\n return envKey;\n\n if (File.Exists(\"deepseek.key\"))\n return File.ReadAllText(\"deepseek.key\").Trim();\n\n if (File.Exists(\"deepseek.key.txt\"))\n return File.ReadAllText(\"deepseek.key.txt\").Trim();\n\n throw new Exception(\"API key not found. Set DEEPSEEK_API_KEY environment variable or create deepseek.key or deepseek.key.txt file in the project root.\");\n }\n\n private static async Task<string> GenerateStoriesWithDeepSeek(string prompt, string apiKey)\n {\n using var client = new HttpClient();\n client.DefaultRequestHeaders.Add(\"Authorization\", $\"Bearer {apiKey}\");\n\n var requestPayload = new\n {\n model = \"deepseek-v4-flash\",\n messages = new[]\n {\n new\n {\n role = \"system\",\n content = \"You are a fiction writer and survival judge. Follow the instructions exactly. Output in the requested format.\"\n },\n new\n {\n role = \"user\",\n content = prompt\n }\n },\n temperature = 0.85,\n max_tokens = 2000\n };\n\n var json = JsonSerializer.Serialize(requestPayload);\n var content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n var response = await client.PostAsync(\"https://api.deepseek.com/v1/chat/completions\", content);\n var responseJson = await response.Content.ReadAsStringAsync();\n\n if (!response.IsSuccessStatusCode)\n {\n throw new Exception($\"DeepSeek API error: {response.StatusCode}\\n{responseJson}\");\n }\n\n using var doc = JsonDocument.Parse(responseJson);\n var story = doc.RootElement\n .GetProperty(\"choices\")[0]\n .GetProperty(\"message\")\n .GetProperty(\"content\")\n .GetString();\n\n return story ?? \"Failed to generate stories.\";\n }\n\n private static string GetScenarioDescription(Scenario scenario) => scenario switch\n {\n Scenario.FeudalReset => \"Wealth concentrates into land and physical assets as society reorders into feudal structures.\",\n Scenario.Redistributed => \"Existing wealth is rapidly redistributed, changing who holds liquid assets without massive inflation.\",\n Scenario.ScorchedEarth => \"Conflicts escalate, infrastructure is destroyed and supply chains fail.\",\n Scenario.TribalCollapse => \"Central authority collapses, local militias and informal powers take control.\",\n Scenario.LateBubble => \"A panic-driven spike occurs mid-week followed by a crash the following week.\",\n _ => \"A global economic shift occurs.\"\n };\n\n private static T GetUserChoice<T>(string prompt) where T : struct, Enum\n {\n var values = Enum.GetValues<T>();\n Console.WriteLine($\"{prompt} ({typeof(T).Name}):\");\n for (int i = 0; i < values.Length; i++)\n {\n Console.WriteLine($\" {i + 1}. {values[i]}\");\n }\n\n int choice;\n while (true)\n {\n Console.Write(\"Enter number: \");\n if (int.TryParse(Console.ReadLine(), out choice) && choice >= 1 && choice <= values.Length)\n break;\n Console.WriteLine($\"Invalid. Enter 1-{values.Length}.\");\n }\n\n return values[choice - 1];\n }\n}"}}}}