// Jorge Martinez // Solarbyte // This software is avaliable free for personal and educational reasons. // See more information at www.Solarbyte.org using System; namespace StruggleSimulator { class Player { public int happiness { get; set; } public int employment { get; set; } public int energy { get; set; } public int money { get; set; } public int food { get; set; } public int time { get; set; } public string name { get; set; } public Player() { name = ""; happiness = 5; employment = 5; energy = 5; money = 50; food = 5; time = 12; } } class GameController { Player Pl; bool isHome = true; int dayCount = 0; bool[] achievement; //Main Entry Fuction static void Main() { GameController GC = new GameController(); GC.Play(); } //play Loop void Play() { isHome = true; dayCount = 0; Pl = new Player(); achievement = new bool[2]; Console.ForegroundColor = ConsoleColor.White; PrintSolarByte(); Console.ForegroundColor = ConsoleColor.Green; Pl.name = Console.ReadLine(); Console.Clear(); while (true) { CheckStats(); if (isHome) { EventHome(); DisplayHome(); PerformActionHome(); } else { DisplayWork(); PerformActionWork(); } } } //display prompt and current values; void DisplayHome() { DisplayStats(); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", "", "")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [1] Relax", "+1H -1E -1F -1T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [2] Go Out", "+4H -1E -20M -1T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [3] Sleep", " +4E -4F -4T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [4] Make Food", " -1E +5F -1T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [5] Order Food", "-1H +5F -10M ")); Console.WriteLine("|_______________________|______________________|"); } //display prompt and current values; void DisplayWork() { DisplayStats(); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", "", "")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [1] Help Customer", "-1H +1Em -1E +8M -1T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [2] Talk To Coworkers", "+1H -1Em -1E -1T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [3] Sleep", " -3Em +3E -3T")); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", " [4] 'Bathroom Break'", " -1Em +1E -1T")); Console.WriteLine("|_______________________|______________________|"); } void DisplayStats() { if (isHome) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You are home!"); } else { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("You are at Work... great"); } Console.WriteLine("________________________________________________"); Console.WriteLine("| |"); Console.WriteLine(String.Format("| {0,-37}{1,-7} |", Pl.name, "Day:" + dayCount)); Console.WriteLine("|______________________________________________|"); Console.WriteLine(String.Format("|{0,-22} | {1,-20} |", "", "")); SetColor(Pl.happiness); Console.Write(String.Format("|{0,-22} |", " (H)Happiness " + Pl.happiness)); SetColor(Pl.money); Console.WriteLine(String.Format(" {0,-20} |", "(M)Money " + Pl.money)); SetColor(Pl.employment); Console.Write(String.Format("|{0,-22} |", " (Em)Employment " + Pl.employment)); SetColor(Pl.food); Console.WriteLine(String.Format(" {0,-20} |", "(F)Food " + Pl.food)); SetColor(Pl.energy); Console.Write(String.Format("|{0,-22} |", " (E)Energy " + Pl.energy)); SetColor(Pl.time); Console.WriteLine(String.Format(" {0,-20} |", "(T) timeLeft " + Pl.time)); if (isHome) Console.ForegroundColor = ConsoleColor.Green; else Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("|_______________________|______________________|"); } //red <= 3 yellow 3><=7 green>7 void SetColor(int number) { Console.ForegroundColor = ConsoleColor.Green; if (number <= 7) Console.ForegroundColor = ConsoleColor.Yellow; if (number <= 3) Console.ForegroundColor = ConsoleColor.Red; } // gets input and updates values void PerformActionHome() { switch (ParseInput()) { case 1://Relax Pl.happiness++; Pl.energy--; Pl.food--; Pl.time--; break; case 2://Go out Pl.happiness += 4; Pl.energy--; Pl.money -= 20; Pl.time--; break; case 3://Sleep Pl.energy += 4; Pl.food -= 4; Pl.time -= 4; break; case 4://Make Food Pl.energy--; Pl.food += 5; Pl.time--; break; case 5://Order Food Pl.happiness--; Pl.food += 5; Pl.money -= 10; break; } //clear console Console.Clear(); } //random Customer Interaction void CustomerInteraction() { switch (new Random().Next(0, 5)) { case 0: Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Can I get H M D 1 to Bluetooth adapter?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Sorry sir, we don't carry that"); Console.WriteLine("[2] It doesn't work that way"); Console.WriteLine("[3] It doesn't work that way, you pleb"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("Well I saw it online so where is it?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Sorry sir, we don't carry that"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Let me talk to your manager!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Alright let me get the manager (hide in back for a bit)"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); break; case 1: Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Do you have a WI-FI router that doesn't cause cancer?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Yeah let me show you"); Console.WriteLine("[2] WI-FI routers don't cause cancer"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("I read it online it said they're not safe!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] ...."); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("It said they use electricity waves and it goes in the air!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] *Contemplate if Darwinism is real*"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); break; case 2: Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("I want to buy a spy camera."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Sure let me show you what we have"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("This one looks good but how far can it see?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Well it has a 720p camera so it can go rou..."); Console.WriteLine("[2] What do you mean?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("No No No, how far can it see?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Uh well how are you going to use it?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("Like if I put it in the kitchen can it see in my bedroom?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] can you physically see the bedroom from the kitchen?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("No there's a few walls in the way"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] .... then no?"); Console.WriteLine("[2] probably not"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("Why not?"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] If you can't see it the camera can't see it"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("This place is horrible why don't you guys have that!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Have a nice day"); Console.WriteLine("[2] ..."); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); break; case 3: Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("I need a cheap high def camera to watch my dog."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Sure let me show you what we have"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("Na Na Na too expensive! Show me the cheaper one but make it good!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Okay *show cheapest shit tier camera on the market*"); Console.WriteLine("[2] Okay *show a middle ground*"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("No No No, My dog is really expensive I need a better camera that is cheap."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Uh well what is your price range?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("People will steal my dog because he is really expensive!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] ... uh okay"); Console.WriteLine("[2] So what do you think of this camera?"); Console.WriteLine("[3] So what is your price range?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("No You are not understanding my dog is really special"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] sir we closed 5 minutes ago can you please give me a price range?"); Console.WriteLine("[2] How about this camera"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("You know what I'm out of here."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Have a good one."); Console.WriteLine("[2] ..."); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); break; case 4: Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("I want to play the new COD on my computer."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Sure what kind of computer do you have?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("It's a dell."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] What kind of dell is it?"); Console.WriteLine("[2] Do you know the specs?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("I don't know."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] What version of windows is it running?"); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("Windows 95"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] ... that wont be able to play the game."); Console.WriteLine("[2] I would recommend you upgrade before trying to play this on your machine."); Console.WriteLine("[3] Sorry your pc doesn't meet the minimum requirements."); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("Just give me the game!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] I just want to let you know you wont be able to run it."); Console.WriteLine("[2] Sure here you go."); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); Console.WriteLine("I'll just return it if it doesn't work!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[1] Have a good one."); Console.WriteLine("[2] ..."); Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); Console.ReadLine(); break; } } // gets input and updates values void PerformActionWork() { switch (ParseInput()) { case 1://Help Customer Pl.happiness--; Pl.employment++; Pl.energy--; Pl.money += 8; Pl.time--; CustomerInteraction(); break; case 2://Talk to coworker Pl.happiness++; Pl.employment--; Pl.energy--; Pl.time--; break; case 3://Sleep Pl.employment -= 3; Pl.energy += 3; Pl.time -= 3; break; case 4://'Bathroom break' Pl.employment--; Pl.energy++; Pl.time--; break; } //clear console Console.Clear(); } //parsesInput returns int static int ParseInput() { while (true) { Console.ForegroundColor = ConsoleColor.White; Console.Write(">"); switch (Console.ReadLine().ToLower()) { case "1": return 1; case "2": return 2; case "3": return 3; case "4": return 4; case "5": return 5; case "exit": Environment.Exit(0); break; } Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid Input..."); } } //handles Achivement void EventHome() { if (dayCount == 3 && Pl.money >= 0 && !achievement[0]) { achievement[0] = true; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("achievement unlocked: Made it 3 days without crippling debt"); Console.WriteLine("Enter To Continue"); Console.ReadLine(); } if (dayCount == 7 && !achievement[1]) { achievement[1] = true; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("achievement unlocked: Made it a week without going postal"); Console.WriteLine("Enter To Continue"); Console.ReadLine(); } } //checks for gameover state; also checks low stats and updates void CheckStats() { //Go To Work/Come Home if (Pl.time <= 0) { isHome = !isHome; if (isHome) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Bills... -25 Money"); Pl.money -= 50; Pl.time = 12; dayCount++; } else { //check if late to work if (Pl.time < 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("YOU WERE LATE BY " + (Pl.time * -1)); Console.WriteLine("Employment Decreased!"); Pl.employment += Pl.time; } Pl.time = 8 + Pl.time; } } //check values to maximums if (Pl.happiness > 10) Pl.happiness = 10; if (Pl.employment > 10) Pl.employment = 10; if (Pl.energy > 10) Pl.energy = 10; if (Pl.food > 10) Pl.food = 10; //check for 0 or negatives if (Pl.money <= 0) { Pl.happiness -= 2; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Your Money is at " + Pl.money + " so your Happiness decreased By 2!"); } if (Pl.happiness <= 0) { Pl.energy -= 2; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Your Happiness is at " + Pl.happiness + " so your Energy decreased By 2!"); } if (Pl.food <= 0) { Pl.energy -= 2; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Your Food is at " + Pl.food + " so your Energy decreased By 2!"); } if (Pl.energy <= 0 && !isHome) { Pl.employment -= 2; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Your Energy is at " + Pl.energy + " so your Employment decreased By 2!"); } //end game if (Pl.employment <= 0) { DisplayStats(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Your employment fell to " + Pl.employment + ". You were Fired!"); Console.WriteLine("GAME OVER!"); while (true) { Console.WriteLine("Try Again? [Y,N]"); string input = Console.ReadLine().ToLower(); if (input.Equals("y")) { Play(); } if (input.Equals("n")) { Environment.Exit(0); } } } //check min values if (Pl.happiness < -5) Pl.happiness = -5; if (Pl.energy < -5) Pl.energy = -5; if (Pl.food < -5) Pl.food = -5; } //solarbyte Logo void PrintSolarByte() { Console.WriteLine( " # \n" + " # \n" + " # \n" + " # ### # \n" + " # ### # \n" + " ## ### ## \n" + " ### #### ### \n" + " #### ##### ### \n" + " ##### ##### #### \n" + " ###### ###### ###### \n" + " ###### ###### ###### \n" + " # ####### ####### ######## # \n" + " ### ####################### #### \n" + " ####### ###### # ###### ######## \n" + " ######### #### # #### ########## \n" + " ############# # ############ \n" + " ############ # ########### \n" + " ####### ############## ####### \n" + " ##### ## ######## ## #### \n" + " #### ## ###### ## # ### \n" + " ### ######## ### \n" + " Welcome To ################# Enter Your \n" + " The Struggle ##### ##### Name \n" + " ## ### " ); Console.Write(">"); } } }