예제 #1
0
        public void TestGetPivotLocation3()
        {
            var game = new Game(Board.CreateEmpty(5, 7), null, null, 0, 0, 0, -1, -1, string.Empty, 0);
            var unit = Unit.Create(new Point(2, 4), new[]
            {
                new Point(2, 1), new Point(5, 1), new Point(1, 2), new Point(3, 2), new Point(4, 2), new Point(6, 2), new Point(7, 2), new Point(4, 3), new Point(5, 3),
            });

            var actual = game.GetPivotLocation(unit);
            Assert.AreEqual(1, actual.Col);
            Assert.AreEqual(3, actual.Row);

            var gameUnit = new GameUnit(unit, new UnitPosition(actual, 0));
            Assert.IsTrue(game.IsValid(gameUnit));
            Console.WriteLine(game.Board.Place(gameUnit.GetAbsolutePoints()).ToString());
        }
예제 #2
0
        public void TestIsValid()
        {
            var game = new Game(Board.Create(new[]
            {
                ".........",
                "....*....",
                "...*.*...",
                "....*....",
                ".........",
                ".........",
            }), null, null, 0, 0, 0, -1, -1, string.Empty, 0);

            var actual = game.IsValid(new GameUnit(
                Unit.Create(new Point(0, 0), new[] { new Point(3, 1), new Point(5, 1), new Point(4, 2), new Point(3, 3), new Point(5, 3) }),
                new UnitPosition(new Point(0, 0), 0)
            ));
            Assert.IsTrue(actual);

            actual = game.IsValid(new GameUnit(
                                      Unit.Create(new Point(0, 0),
                                                  new[]
                                                      {
                                                          new Point(3, 1), new Point(5, 1), new Point(4, 2),
                                                          new Point(3, 3), new Point(5, 3), new Point(3, 2),
                                                      }),
                                      new UnitPosition(new Point(0, 0), 0)
                                      ));
            Assert.IsFalse(actual);
        }