Exemplo n.º 1
0
    public void FindAdjacentCellTest(int maxY, int maxX,
                                     int cellIndex, WallIndex wallIndex, int expected)
    {
        // Arrange
        MazeShaperZ shaper = new MazeShaperZ(maxY, maxX);

        // Act
        int adjacentResult = shaper.FindAdjacentCellIndex(cellIndex, wallIndex);

        // Assert
        Assert.That(adjacentResult, Is.EqualTo(expected));
    }
Exemplo n.º 2
0
    public void RemoveOtherSideOfWall(int cellIndex, WallIndex wallIndex)
    {
        int oppositeCellIndex = _mazeShaper.FindAdjacentCellIndex(cellIndex, wallIndex);

        if (oppositeCellIndex < 0 || oppositeCellIndex >= _mazeCells.Count)
        {
            return;
        }

        WallIndex oppositeDirection = FindOppositeDirection(wallIndex);

        if ((int)oppositeDirection >= 0 && (int)oppositeDirection < _mazeCells.Count)
        {
            if (_mazeCells[oppositeCellIndex].DoesWallExist(oppositeDirection))
            {
                _mazeCells[oppositeCellIndex].RemoveWall(oppositeDirection);
            }
        }
    }