예제 #1
0
        public void Process_Health50BesideATavern_1Paths()
        {
            var map   = MapTest.Map10Mines8;
            var state = State.Create(0,
                                     new Hero(50, 1, 0, 0, 0),
                                     new Hero(100, 8, 0, 0, 0),
                                     new Hero(100, 8, 9, 0, 0),
                                     new Hero(100, 1, 9, 0, 0),
                                     MineOwnership.Create(map));

            var source = map[state.Hero1];
            var mines  = state.Mines;

            var collection = SafePathCollection.Create(map, state);
            var processor  = new DrinkBeerProcessor();

            processor.Initialize(map, state);

            var path = PotentialPath.Initial(source, map, state);

            processor.Process(path, collection);

            var act = collection.GetPotentialPaths();

            Assert.AreEqual(1, act.Count);
            PotentialPathAssert.AreEqual(1, source, 99, mines, MoveDirections.E, -2, act[0]);
        }
예제 #2
0
        public void Process_Get1MineAfterDrinkingTwice_4Mines15Turns42Profit()
        {
            var map   = MapTest.Map10Mines8;
            var state = State.Create(1,
                                     new Hero(99, 8, 9, 0, 2),
                                     new Hero(01, 1, 0, 0, 0),
                                     new Hero(50, 3, 2, 0, 0),
                                     new Hero(99, 8, 8, 0, 0),
                                     MineOwnership.Parse(".22......"));

            var collection = SafePathCollection.Create(map, state);

            collection.Procces();
            foreach (var item in collection)
            {
                Console.WriteLine(item.DebuggerDisplay);
            }

            var act = collection.BestPath;
            var exp = new SafePath(3, 7, 13, MoveDirection.E);

            Assert.AreEqual(exp, act);
        }
예제 #3
0
        public void Process_Get4Mines_4Mines15Turns42Profit()
        {
            var map   = MapTest.Map10Mines8;
            var state = State.Create(0,
                                     new Hero(100, 3, 4, 0, 0),
                                     new Hero(100, 8, 0, 0, 0, true),
                                     new Hero(100, 8, 9, 0, 0, true),
                                     new Hero(100, 1, 9, 0, 0, true),
                                     MineOwnership.Create(map));

            var collection = SafePathCollection.Create(map, state);

            collection.Procces();
            foreach (var item in collection)
            {
                Console.WriteLine(item.DebuggerDisplay);
            }

            var act = collection.BestPath;
            var exp = new SafePath(4, 15, 42, MoveDirection.E);

            Assert.AreEqual(exp, act);
        }
예제 #4
0
        public void Process_Get1Mine1Mine4Turns4Profit()
        {
            var map   = MapTest.Map10;
            var state = State.Create(0,
                                     new Hero(23, 0, 0, 0, 0),
                                     new Hero(99, 9, 0, 0, 0),
                                     new Hero(99, 9, 9, 0, 0),
                                     new Hero(99, 0, 9, 0, 0),
                                     MineOwnership.Create(map));

            var collection = SafePathCollection.Create(map, state);

            collection.Procces();
            foreach (var item in collection)
            {
                Console.WriteLine(item.DebuggerDisplay);
            }

            var act = collection.BestPath;
            var exp = new SafePath(1, 4, 4, MoveDirection.S);

            Assert.AreEqual(exp, act);
        }
예제 #5
0
        public void Process_Health99BesideATavern_NoPaths()
        {
            var map   = MapTest.Map10Mines8;
            var state = State.Create(0,
                                     new Hero(100, 1, 0, 0, 0),
                                     new Hero(100, 8, 0, 0, 0),
                                     new Hero(100, 8, 9, 0, 0),
                                     new Hero(100, 1, 9, 0, 0),
                                     MineOwnership.Create(map));

            var collection = SafePathCollection.Create(map, state);
            var processor  = new DrinkBeerProcessor();

            processor.Initialize(map, state);

            var path = PotentialPath.Initial(map[state.Hero1], map, state);

            processor.Process(path, collection);

            var act = collection.GetPotentialPaths();

            Assert.AreEqual(0, act.Count);
        }