コード例 #1
0
ファイル: Program.cs プロジェクト: GoodMan93/bot
        static void Main(string[] args)
        {
            var stream = new StreamReader("../../1.txt");

            var forest = new Forest();

            var mapLoader = new MapLoader();
            mapLoader.Download(stream, out forest.map);

            var visualizer = new Visualizer(forest);

            var cr1 = new Creature('A', "Alice", 4, 5,3,7);
            //Console.WriteLine("{0} {1} {2}", cr1.X, cr1.Y, cr1.Lifes);

            var cr2 = new Creature('B', "BoBa", 4, 5,1,1);
            //var cr3 = new Creature('C',3,4,2);

            forest.AddCreature(cr1);
            //forest.AddCreature(cr2);

            //forest.TryToMove(cr1, new Left());
            //forest.TryToMove(cr1, new Left());
            //forest.TryToMove(cr1, new Up());

            //forest.TryToMove(cr2, new Left());
            //forest.TryToMove(cr2, new Left());
            //forest.TryToMove(cr2, new Up());

            //Console.WriteLine("{0} {1} {2}", cr1.X, cr1.Y, cr1.Lifes);
            var bot1 = new Bot(cr1, forest);
            bot1.GoToEnd();
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: GoodMan93/bot
 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());
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: DuckGoesQuack/bot
        static void Main(string[] args)
        {
            var stream = new StreamReader("../../1.txt");

            var forest = new Forest();

            var mapLoader = new MapLoader();

            mapLoader.Download(stream, out forest.map);

            var visualizer = new Visualizer(forest);

            var cr1 = new Creature('A', "Alice", 4, 5, 3, 7);
            //Console.WriteLine("{0} {1} {2}", cr1.X, cr1.Y, cr1.Lifes);

            var cr2 = new Creature('B', "BoBa", 4, 5, 1, 1);

            //var cr3 = new Creature('C',3,4,2);


            forest.AddCreature(cr1);
            //forest.AddCreature(cr2);

            //forest.TryToMove(cr1, new Left());
            //forest.TryToMove(cr1, new Left());
            //forest.TryToMove(cr1, new Up());

            //forest.TryToMove(cr2, new Left());
            //forest.TryToMove(cr2, new Left());
            //forest.TryToMove(cr2, new Up());

            //Console.WriteLine("{0} {1} {2}", cr1.X, cr1.Y, cr1.Lifes);
            var bot1 = new Bot(cr1, forest);

            bot1.GoToEnd();
        }
コード例 #4
0
 public Bot(Creature cr, Forest forest)
 {
     Creature = cr;
     OldLifes = cr.Lifes;
     Forest   = forest;
 }
コード例 #5
0
 public Visualizer(Forest forest)
 {
     Forest          = forest;
     forest.Changed += ListChanged;
 }
コード例 #6
0
ファイル: Visualizer.cs プロジェクト: GoodMan93/bot
 public Visualizer(Forest forest)
 {
     Forest = forest;
     forest.Changed += ListChanged;
 }
コード例 #7
0
ファイル: Bot.cs プロジェクト: GoodMan93/bot
 public Bot(Creature cr, Forest forest)
 {
     Creature = cr;
     OldLifes = cr.Lifes;
     Forest = forest;
 }