Esempio n. 1
0
        static void Main(string[] args)
        {
            List <int> stones = Console.ReadLine()
                                .Split(", ")
                                .Select(int.Parse)
                                .ToList();

            Lake lake = new Lake(stones);

            Console.WriteLine(string.Join(", ", lake));
        }
Esempio n. 2
0
        static void Main()
        {
            // Populate forest
            var lake1  = new Lake(40, 40, 60, 60, 500);
            var stone1 = new Stone(20, 0, 0);

            Objects.Add(lake1);
            Objects.Add(stone1);

            LivingObject tree1 = new Tree(3, 10, 25);

            var animal1 = new Animal(3, 4);
            var bird1   = new Bird(1, 20);

            LivingObjects.Add(tree1);
            LivingObjects.Add(animal1);
            LivingObjects.Add(bird1);

            // Forest commands
            while (true)
            {
                Print();

                var input = Console.ReadLine();

                switch (input)
                {
                case "next":
                    Continue();
                    break;

                case "move":
                    var x = byte.Parse(Console.ReadLine());
                    var y = byte.Parse(Console.ReadLine());

                    animal1.Move(x, y);
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 3
0
        static void Main()
        {
            // Populate forest
            var lake1     = new Lake(40, 40, 60, 60, 500);
            var stone1    = new Stone(20, 7, 15);
            var mountain1 = new Mountain(80, 75, 1300);

            Objects.Add(lake1);
            Objects.Add(stone1);
            Objects.Add(mountain1);

            LivingObject tree1 = new Tree(3, 10, 25);

            var animal1 = new Animal(3, 4);
            var bird1   = new Bird(1, 20);

            LivingObjects.Add(tree1);
            LivingObjects.Add(animal1);
            LivingObjects.Add(bird1);

            MovingObject.Add(animal1);
            MovingObject.Add(bird1);

            // Forest commands
            while (true)
            {
                Print();

                var input = Console.ReadLine();

                switch (input)
                {
                case "next":
                    Continue();
                    break;

                default:
                    ObjMove();
                    break;
                }
            }
        }