static void Main(string[] args)
        {
            Title           = "Pet Sim";
            ForegroundColor = ConsoleColor.DarkGreen;
            BackgroundColor = ConsoleColor.White;
            Clear();
            WriteLine("Welcome to the Pet Sim!");

            VirtualPet jimothy = new VirtualPet("Jimothy", "Blue", 4);

            jimothy.Greet();
            jimothy.Feed("An apple");

            VirtualPet bubs = new VirtualPet("Bubs", "Black", 2);

            bubs.Greet();
            bubs.Feed("Brownie");

            VirtualPet bob = new VirtualPet("Bob", "BluePinkOrange", 0);

            bob.Greet();
            bob.Feed("Candy Bar");

            ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            VirtualPet fidget = new VirtualPet("Fidget", 5, 5, 7);

            Console.WriteLine("Thank you for adopting {0} the mini-moo", fidget.Name);
            Console.WriteLine("She requires special care & needs to be monitored carefully");
            Console.WriteLine("She will need food, naps & exercise if she gets too restless");
            Console.WriteLine("You will get a warning if she gets hungry, tired or too fidgety");
            Console.WriteLine("Type yes if you would like to take care of {0} now?", fidget.Name);
            string userResp = Console.ReadLine().ToLower();

            while (userResp.Equals("yes"))
            {
                fidget.Tick();

                Console.WriteLine();
                Console.WriteLine("{0} the mini-moo:", fidget.Name);
                Console.WriteLine("Hunger is at {0} ", fidget.Hunger);
                Console.WriteLine("Sleepiness is at {0} ", fidget.Sleep);
                Console.WriteLine("Restlessness is at {0}", fidget.Activity);
                if (fidget.Hunger < 3)
                {
                    Console.WriteLine("{0} is hungry, you need to feed her", fidget.Name);
                }
                if (fidget.Sleep < 3)
                {
                    Console.WriteLine("{0} is exhausted; she needs a nap", fidget.Name);
                }
                if (fidget.Activity > 10)
                {
                    Console.WriteLine("{0} is too restless, you need to play with her", fidget.Name);
                }

                Console.WriteLine("Select one of the options below to care for {0} ", fidget.Name);
                Console.WriteLine("1 will let you feed {0}", fidget.Name);
                Console.WriteLine("2 will let you give {0} a nap", fidget.Name);
                Console.WriteLine("3 will give {0} some much needed exercise", fidget.Name);
                int userSel = int.Parse(Console.ReadLine());

                switch (userSel)
                {
                case 1:
                    fidget.Feed();
                    Console.WriteLine("You gave {0} some food. Thank you!", fidget.Name);
                    break;

                case 2:
                    fidget.Rest();
                    Console.WriteLine("{0} is now resting.  She'll feel much better", fidget.Name);
                    break;

                case 3:
                    fidget.Play();
                    Console.WriteLine("{0} got some exercise. She's much happier now", fidget.Name);
                    break;

                default:
                    break;
                }

                Console.WriteLine("Type yes if you would like to take care of {0} now?", fidget.Name);
                userResp = Console.ReadLine().ToLower();
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            VirtualPet bruce = new VirtualPet(0, 6, 1, 4, 9);
            Random     r     = new Random();

            string[] rFood      = new string[4];
            string[] rInteract  = new string[2];
            string   userChoice = " ";

            Timer
                petTimer = new System.Timers.Timer();

            petTimer.Interval = 12000; // 12 second intervals

            petTimer.AutoReset = true; // Resets for repeated events

            petTimer.Enabled = true;   // Start timer

            petTimer.Elapsed += Event; // Create event after elapsed time

            void Event(Object source, System.Timers.ElapsedEventArgs e)
            {
                bruce.Tick();
                Console.WriteLine("Bruce's levels have changed!!");  // Prints every 12 seconds to notify user
            }

            Console.WriteLine("Bruce the Panther");
            Console.WriteLine("Keep levels as close to zero as possible");
            Console.WriteLine("Bruce's levels randomly change every 12 seconds \n");

            while (userChoice != "7")
            {
                Console.WriteLine("What would you like to do? \n");
                Console.WriteLine("1. Feed Bruce");
                Console.WriteLine("2. Give Bruce Water");
                Console.WriteLine("3. Take Bruce out to potty");
                Console.WriteLine("4. Interact with Bruce");
                Console.WriteLine("5. Let Bruce Sleep");
                Console.WriteLine("6. Check Bruce's levels");
                Console.WriteLine("7. Exit");
                userChoice = (Console.ReadLine());

                switch (userChoice)
                {
                case "1":
                    if (bruce.Hunger >= 2)
                    {
                        bruce.Feed();
                        Console.WriteLine("You fed Bruce " + Foods(rFood));
                    }
                    else
                    {
                        Console.WriteLine("Bruce walks away, he is not hungry");
                    }
                    break;

                case "2":
                    bruce.DrinkUp();
                    break;

                case "3":
                    bruce.Potty();
                    break;

                case "4":
                    if (bruce.Interact >= 3)
                    {
                        bruce.Play();
                        Console.WriteLine(Interactions(rInteract));
                    }
                    else
                    {
                        Console.WriteLine("Bruce growls at you, he is not in the mood to play");
                    }
                    break;

                case "5":
                    bruce.IsTired();
                    break;

                case "6":
                    bruce.CheckLevels();
                    break;

                case "7":
                    Console.WriteLine("Bruce doesn't like to be alone and stares angrily as you walk away....");
                    break;
                }
                Console.WriteLine("");
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            VirtualPet vPet  = new VirtualPet();
            string     input = "";

            Console.WriteLine("Pet Rock Simulator 2018");
            Console.WriteLine();
            Console.WriteLine("Your Pet Rock is named Jeffrey. You love him very much.");
            Console.ReadLine();
            Console.WriteLine();
            vPet.Hunger  = 0;
            vPet.Thirst  = 0;
            vPet.Waste   = 0;
            vPet.Boredom = 0;
            vPet.Tired   = 0;
            vPet.Anger   = 0;

            while (input != "exit")
            {
                Console.WriteLine("JEFFREY");
                Console.WriteLine("Hunger: " + vPet.Hunger);
                Console.WriteLine("Thirst: " + vPet.Thirst);
                Console.WriteLine("Waste: " + vPet.Waste);
                Console.WriteLine("Boredom: " + vPet.Boredom);
                Console.WriteLine("Exhaustion: " + vPet.Tired);
                Console.WriteLine();
                Console.WriteLine("Enter the number of what you would like to do.");
                Console.WriteLine("1. Play With Your Pet Rock");
                Console.WriteLine("2. Walk Your Pet Rock");
                Console.WriteLine("3. Feed Your Pet Rock");
                Console.WriteLine("4. Give Your Pet Rock Water");
                Console.WriteLine("5. Have Your Pet Rock Take a Nap");
                Console.WriteLine("Or type exit to close program.");
                input = Console.ReadLine().ToLower();
                Console.WriteLine();

                if (input == "exit")
                {
                    return;
                }
                else if (input == "1")
                {
                    Console.WriteLine("You challenge your Pet Rock to a rousing game of Backgammon.");
                    Console.ReadLine();
                    vPet.Play();
                }
                else if (input == "2")
                {
                    Console.WriteLine("You put a leash on your Pet Rock and take to the streets, where it can do its disgusting business.");
                    Console.ReadLine();
                    vPet.Walk();
                }
                else if (input == "3")
                {
                    Console.WriteLine("You give your Pet Rock a bowl a gravel to eat and mull the ethical ramifications.");
                    Console.ReadLine();
                    vPet.Feed();
                }
                else if (input == "4")
                {
                    Console.WriteLine("You drop your Pet Rock into some water and soon the water is gone. You ask no questions.");
                    Console.ReadLine();
                    vPet.Drink();
                }
                else if (input == "5")
                {
                    Console.WriteLine("You assume your Pet Rock is sleeping, but it's impossible to tell for sure.");
                    Console.ReadLine();
                    vPet.Sleep();
                }
                else
                {
                    Console.WriteLine("You stare at your Pet Rock and think about your life choices.");
                    Console.ReadLine();
                }

                vPet.Tick();
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            //entering the shop
            Console.WriteLine("Welcome to the Pet Shop!");
            Console.WriteLine("We have a variety of pets here to take care of.");

            System.Threading.Thread.Sleep(1000);

            Console.WriteLine("I see you've made a decision!");

            Console.WriteLine("Please tell me, what is your animal?");
            string animalType = Console.ReadLine().ToLower();

            Console.WriteLine("And what is it's name?");
            string name = Console.ReadLine();

            VirtualPet yourPet = new VirtualPet(name, animalType);

            Console.WriteLine("You have chosen a " + animalType + " and have named it " + name + ".");
            Console.WriteLine("Congratulations on your new pet!");
            Console.WriteLine("What would you like to do now?");

            //random number generator
            Random stat = new Random();

            //establishes your pet's stats to begin with
            yourPet.Hunger   = stat.Next(1, 10);
            yourPet.Thirst   = stat.Next(1, 10);
            yourPet.Waste    = stat.Next(1, 10);
            yourPet.Boredom  = stat.Next(1, 10);
            yourPet.Tired    = stat.Next(1, 10);
            yourPet.Sickness = stat.Next(1, 10);

            //initial stats
            yourPet.Stats();

            Console.WriteLine();
            System.Threading.Thread.Sleep(100);

            //initial action items
            Console.WriteLine("I'd like to...");
            Console.WriteLine("1. Feed " + name + ".");
            Console.WriteLine("2. Give " + name + " water.");
            Console.WriteLine("3. Take " + name + " outside to go potty.");
            Console.WriteLine("4. Play with " + name + ".");
            Console.WriteLine("5. Pet " + name + ".");
            Console.WriteLine("6. Heal " + name + ".");
            Console.WriteLine("7. See how my pet is doing.");
            Console.WriteLine("8. Do nothing.");
            Console.WriteLine("9. Abandon my pet.");

            //initial user input
            int userChoice = int.Parse(Console.ReadLine());

            do
            {
                switch (userChoice)
                {
                case 1:
                    yourPet.Feed();
                    if (yourPet.Hunger > 5)
                    {
                        Console.WriteLine("Your pet is still hungry!");
                    }
                    else if (yourPet.Hunger < 0)
                    {
                        yourPet.Hunger = 0;
                    }
                    break;

                case 2:
                    yourPet.Water();
                    if (yourPet.Thirst > 5)
                    {
                        Console.WriteLine("Your pet is still thirsty!");
                    }
                    else if (yourPet.Thirst < 0)
                    {
                        yourPet.Thirst = 0;
                    }
                    break;

                case 3:
                    yourPet.Potty();
                    if (yourPet.Waste == 0)
                    {
                        Console.WriteLine("Your pet is relieved.");
                    }

                    break;

                case 4:
                    yourPet.Play();
                    if (yourPet.Boredom < 0)
                    {
                        yourPet.Boredom = 0;
                    }

                    break;

                case 5:
                    yourPet.Pet();
                    if (yourPet.Tired < 0)
                    {
                        yourPet.Tired = 0;
                    }
                    break;

                case 6:
                    yourPet.Heal();
                    break;

                case 7:
                    yourPet.Stats();
                    break;

                case 8:
                    yourPet.Tick();
                    break;

                case 9:
                    Console.WriteLine("Next time please consider the responsibility of a pet before committing to one.");
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Careful how you handle your pet!");
                    break;
                }



                Console.WriteLine();
                System.Threading.Thread.Sleep(100);



                //action items
                Console.WriteLine("I'd like to...");
                Console.WriteLine("1. Feed " + name + ".");
                Console.WriteLine("2. Give " + name + " water.");
                Console.WriteLine("3. Take " + name + " outside to go potty.");
                Console.WriteLine("4. Play with " + name + ".");
                Console.WriteLine("5. Pet " + name + ".");
                Console.WriteLine("6. Heal " + name + ".");
                Console.WriteLine("7. See how my pet is doing.");
                Console.WriteLine("8. Do nothing.");
                Console.WriteLine("9. Abandon my pet.");

                //user input
                userChoice = int.Parse(Console.ReadLine());
            }while (userChoice < 9);
        }
示例#6
0
        static void Main(string[] args)
        {
            bool caredFor = true;

            Console.WriteLine("What is your pet's name?");
            VirtualPet dog = new VirtualPet(Console.ReadLine());

            Console.WriteLine();
            while (caredFor == true)
            {
                //display pet's current status
                Console.WriteLine("{0} the dog", dog.Name);
                Console.WriteLine("Hunger: {0}", dog.Hunger);
                Console.WriteLine("Thirst: {0}", dog.Thirst);
                Console.WriteLine("Exercise: {0}", dog.Exercise);
                Console.WriteLine("Affection: {0}", dog.Affection);
                Console.WriteLine();

                //displays options to interact with pet
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1. Feed {0}", dog.Name);
                Console.WriteLine("2. Water {0}", dog.Name);
                Console.WriteLine("3. Walk {0}", dog.Name);
                Console.WriteLine("4. Cuddle with {0}", dog.Name);
                Console.WriteLine("5. Abandon {0}", dog.Name);
                Console.WriteLine();

                //takes in user's selection
                int input = int.Parse(Console.ReadLine());
                dog.Tick();

                //user's selection triggers an action
                switch (input)
                {
                case (1):
                    dog.Feed();
                    break;

                case (2):
                    dog.Drink();
                    break;

                case (3):
                    dog.Walk();
                    break;

                case (4):
                    dog.Cuddle();
                    break;

                case (5):
                    caredFor = false;
                    Console.WriteLine("{0} is better without you anyway.", dog.Name);
                    break;

                default:
                    break;
                }

                if (dog.Hunger <= 0 || dog.Thirst <= 0 || dog.Affection <= 0 || dog.Exercise <= 0)
                {
                    caredFor = false;
                    Console.WriteLine("{0} felt neglected and ran away to find a better home.", dog.Name);
                }
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            VirtualPet algernon = new VirtualPet("Algernon", 5, 40, 5, 40, 5, 40, 0, 50, 0, 0);

            string[] choices = new string[5] {
                "1. Play", "2. Feed", "3. Sleep", "4. Go to the Doctor", "5. Do Nothing"
            };


            string exitResponse = "yes";

            Console.WriteLine("You wake up to a letter and a box on your dresser Would you like to open it?");
            Console.WriteLine("(Yes or No?)");
            exitResponse = Console.ReadLine().ToLower();
            if (exitResponse.Equals("yes"))
            {
                while (exitResponse.Equals("yes"))
                {
                    Console.WriteLine("Greetings!  We have been watching you and we think you would make a good addition to Clotho Magic Academy");
                    Console.WriteLine("Before we can fully accept you, we have one task for you.");
                    Console.WriteLine("Inside this box, you'll find your familar, a pet if you will. If you can manage to take good care of him, you're in!");
                    Console.WriteLine("");
                    Console.WriteLine("The box shifts and shakes...");
                    for (int i = 0; i < 4; i++)
                    {
                        Console.WriteLine("*Shake*");
                    }
                    Console.WriteLine("");
                    Console.WriteLine("A mouse pops out of the box!");
                    Console.WriteLine("Hello! My name is {0}! I'm sure we're going to have a great time together!", algernon.Name);

                    while (algernon.Neglect <= algernon.NeglectMax)
                    {
                        int choiceValue = 0;
                        algernon.CheckStatus();
                        algernon.Tick();
                        Console.Write("");
                        Console.Write("");
                        Console.Write("");
                        Console.WriteLine("What would you like to do today Master!");
                        for (int i = 0; i < choices.Length; i++)
                        {
                            Console.WriteLine(choices[i]);
                        }
                        choiceValue = int.Parse(Console.ReadLine());
                        switch (choiceValue)
                        {
                        case 1: algernon.Play();
                            break;

                        case 2: algernon.Feed();
                            break;

                        case 3: algernon.Sleep();
                            break;

                        case 4: algernon.DoctorVisit();
                            break;

                        case 5:
                            break;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("You have a very normal, not very eventful day...");
            }
        }