Exemplo n.º 1
0
        public void TestFindPath_NoDisplacement()
        {
            int[,] couts = new int[Grid.GRID_WIDTH, Grid.GRID_HEIGHT];
            Grid grid = new Grid();

            couts = PathFinding.InitMoves(couts, 1, 1);

            PathFinding.CalculateMoves(grid, 1, 1, 1, 1, ref couts);

            Assert.AreEqual(0, couts[1, 1]);
        }
Exemplo n.º 2
0
        public void TestFindPath_ImpossibleFromWall()
        {
            int[,] couts = new int[Grid.GRID_WIDTH, Grid.GRID_HEIGHT];
            Grid grid = new Grid();

            couts = PathFinding.InitMoves(couts, 0, 1);

            PathFinding.CalculateMoves(grid, 0, 1, 1, 1, ref couts);

            Assert.AreEqual(0, couts[0, 1]);
            Assert.AreEqual(1, couts[1, 1]);
        }
Exemplo n.º 3
0
        public void TestComputeCost_01()
        {
            //jPos = 23, int iPos = 13
            int[,] couts = new int[Grid.GRID_WIDTH, Grid.GRID_HEIGHT];
            Grid grid = new Grid();

            couts = PathFinding.InitMoves(couts, 1, 1);

            PathFinding.CalculateMoves(grid, 1, 1, 13, 23, ref couts);

            Assert.AreEqual(1, couts[2, 1]);
            Assert.AreEqual(5, couts[6, 1]);
        }