Example #1
0
 public void Test2()
 {
     var stream = new StreamReader("../../2.txt");
     var forest = new Forest();
     var mapLoader = new MapLoader();
     mapLoader.Download(stream, out forest.map);
     var creature = new Creature('A', "Alice", 4, 5, 3, 7);
     forest.AddCreature(creature);
     var bot = new Bot(creature, forest);
     bot.GoToEnd();
     Assert.AreEqual(false, creature.IsAlive());
 }
Example #2
0
        public bool TryToMove(Creature creature, Direction direction)
        {
            while(creature.IsAlive())
            {
                var result = map[creature.X + direction.dx, creature.Y + direction.dy].CanStand(creature, direction);

                if (result)
                    OnChanged(EventArgs.Empty);

                return result;
            }
            Console.WriteLine("Move is impossible. {0} is dead", creature.Name);
            return false;
        }
Example #3
0
        public void Test2()
        {
            var stream    = new StreamReader("../../2.txt");
            var forest    = new Forest();
            var mapLoader = new MapLoader();

            mapLoader.Download(stream, out forest.map);
            var creature = new Creature('A', "Alice", 4, 5, 3, 7);

            forest.AddCreature(creature);
            var bot = new Bot(creature, forest);

            bot.GoToEnd();
            Assert.AreEqual(false, creature.IsAlive());
        }
Example #4
0
        public bool TryToMove(Creature creature, Direction direction)
        {
            while (creature.IsAlive())
            {
                var result = map[creature.X + direction.dx, creature.Y + direction.dy].CanStand(creature, direction);

                if (result)
                {
                    OnChanged(EventArgs.Empty);
                }

                return(result);
            }
            Console.WriteLine("Move is impossible. {0} is dead", creature.Name);
            return(false);
        }