public void RunSimulator()
        {
            bool displayField = false;

            UserLib.OutputHeading("  Foxes and Rabbits Sumulation");

            int lastStep = (int)UserLib.InputNumber("Run the simulation how many times > ");

            Console.WriteLine();

            Console.Write("  Do you want to display the field (Y/N) >");
            string answer = Console.ReadLine();

            if (answer.ToLower() == "y")
            {
                displayField = true;
            }

            for (int step = 1; step <= lastStep; step++)
            {
                simulator.SimulateOneStep();

                if (displayField)
                {
                    Console.WriteLine(simulator.Field.ToString());
                }


                CountAnimals();
                string result = stats.GetPopulationDetails(simulator.Field);
                Console.WriteLine(result);
            }
        }
示例#2
0
        /// <summary>
        /// Input the users height in metres and
        /// their weight in kilograms
        /// </summary>
        private void InputMetricDetails()
        {
            metres = UserLib.InputNumber(
                " \n Enter your height in metres > ");

            kilograms = UserLib.InputNumber(
                " Enter your weight in kilograms > ");
        }
示例#3
0
        /// <summary>
        /// Input the users height in feet and inches and
        /// their weight in stones and pounds
        /// </summary>
        private void InputImperialDetails()
        {
            Console.WriteLine(
                " Enter your height in feet and inches ");
            double feet = UserLib.InputNumber(
                "\n Enter your height in feet > ");

            inches = (int)UserLib.InputNumber(
                " Enter your height in inches > ");

            inches += (int)feet * InchesInFeet;

            Console.WriteLine(
                " Enter your weight in stones and pounds");
            double stones = UserLib.InputNumber(
                " Enter your weight in stones > ");

            pounds = UserLib.InputNumber(
                " Enter your weight in pounds > ");

            pounds += stones * PoundsInStones;
        }