コード例 #1
0
    private void AddToMatrix(SingleMaze maze, int xPos, int yPos)
    {
        var matrix = maze.GetNumericalMatrix();

        for (var x = 0; x < _mazeWidth * 2 + 1; x++)
        {
            for (var y = 0; y < _mazeHeight * 2 + 1; y++)
            {
                _combinedMatrix[xPos + x, yPos + y] = matrix[x, y];
            }
        }
    }
コード例 #2
0
    public CombinedMaze(int mazeWidth, int mazeHeight, int numberOfMazesX, int numberOfMazesY, int seed)
    {
        _mazeWidth      = mazeWidth;
        _mazeHeight     = mazeHeight;
        _numberOfMazesX = numberOfMazesX;
        _numberOfMazesY = numberOfMazesY;
        _mazes          = new SingleMaze[numberOfMazesX, numberOfMazesY];
        var rng = new Random(seed);

        for (var x = 0; x < numberOfMazesX; x += 1)
        {
            for (var y = 0; y < numberOfMazesY; y += 1)
            {
                _mazes[x, y] = new SingleMaze(mazeWidth, mazeHeight, rng.Next());
            }
        }

        _combinedMatrix = new int[mazeWidth * numberOfMazesX * 2 + 1, mazeHeight *numberOfMazesY * 2 + 1];
        CombineMazes();
        AddConnections();

        //        _combinedMatrix[7, 28] = 1;
        //        _combinedMatrix[35, 14] = 1;
    }