Example #1
0
        public void Get8DMatrixMask()
        {
            var matrixHandler  = new Matrix8DGenerator();
            var matrix         = matrixHandler.GetMatrix(2);
            var expectedMatrix = new[]
            {
                new[] { 2 * -1, 2 * -1 },
                new[] { 2 * -1, 2 },
                new[] { 2, 2 * -1 },
                new[] { 2, 2 },
                new[] { 2 * -1, 0 },
                new[] { 2, 0 },
                new[] { 0, 2 * -1 },
                new[] { 0, 2 }
            };

            Assert.True(Enumerable.Range(0, 8).All(i => matrix[i].SequenceEqual(expectedMatrix[i])));
        }
Example #2
0
 public GridCostCalculator(Matrix8DGenerator matrixGenerator, DiagonalDistance gridDistance)
 {
     _gridDistance = gridDistance;
     _positionMask = matrixGenerator.GetMatrix(1);
 }