Total Pageviews

Tuesday, June 21, 2011

Human

public class Human
    {
        public enum _Gender
        {
            Male,
            Female,
            Kid
        }
        _Gender Gender;
        bool Alive;

        DateTime WakeUpTime;
        DateTime SleepTime;

        public Human(_Gender gender)
        {
            Gender = gender;

            while (Alive)
            {
                switch (Gender)
                {
                    case _Gender.Female:
                        {
                            if (DateTime.Now == WakeUpTime)
                            {
                                WakeUp();
                                Think(5);
                                if (Kids != null)
                                {
                                    Drive(Kids, "School");
                                }
                                Think(5);
                                Drive("Home");
                                if (Spouse != null)
                                {
                                    Drive(Spouse, "Work");
                                }
                                Think(5);
                                Drive("Work");
                                Work();
                                Drive("Home");
                                if (Family != null)
                                {
                                    MakeFood(Family);
                                }
                                else
                                {
                                    MakeFood();
                                }
                            }
                            else if (DateTime.Now == SleepTime)
                            {
                                Sleep();
                            }
                            break;
                        }
                    case _Gender.Male:
                        {
                            if (DateTime.Now == WakeUpTime.AddMinutes(45))
                            {
                                WakeUp();
                                Drive("Work");
                                Work();
                                Drive("Home");
                                Eat();
                            }
                            else if (DateTime.Now == SleepTime)
                            {
                                Sleep();
                            }
                            break;
                        }
                    case _Gender.Kid:
                        {
                            if (DateTime.Now == WakeUpTime.AddMinutes(45))
                            {
                                WakeUp();
                                Work();
                                Eat();
                            }
                            else if (DateTime.Now == SleepTime)
                            {
                                Sleep();
                            }
                            break;
                        }
                }

            }
            Die();
        }
        void Die() { }
        void Think(int seconds) { Thread.Sleep(seconds * 1000); }
        void WakeUp()
        {
            switch (Gender)
            {
                case _Gender.Female:
                    {
                        if (Spouse != null)
                        {
                            WakeUp(Spouse);
                        }

                        if (Family != null)
                        {
                            MakeFood(Family);
                            foreach (Human member in Family)
                                member.Eat();
                        }
                        else
                        {
                            MakeFood();
                            Eat();
                        }

                        if (Kids != null)
                        {
                            WakeUp(Kids);
                        }
                        break;
                    }

                case _Gender.Kid:
                case _Gender.Male:
                    {
                        MakeFood();
                        Eat();
                        break;
                    }
            }
        }
        void WakeUp(Human husband)
        {
            husband.WakeUp();
        }
        void WakeUp(Human[] kids)
        {
            foreach (Human kid in kids)
            {
                kid.WakeUp();
            }
        }
        void MakeFood() { }
        void MakeFood(Human To) { }
        void MakeFood(Human[] To) { }
        void Eat() { }
        void Drive(Human[] Who, string Destination) { }
        void Drive(Human Who, string Destination) { }
        void Drive(string Destination) { }
        void Work() { }
        void Sleep() { }

        Human Spouse;
        Human[] Kids;
        Human[] Family;
    }

1 comment:

  1. could this program actually do something, or is it sorta gibberish? Also glad to have you back

    ReplyDelete