コード例 #1
0
//``````````````````````````````````````````````````````````````````````````````````````````````````````````
//``````````````````````````````````````````````````````````````````````````````````````````````````````````
    private static StateOfWall GetOppositeWall(StateOfWall wall)
    {
        switch (wall)
        {
        case StateOfWall.Right: return(StateOfWall.Left);

        case StateOfWall.Left: return(StateOfWall.Right);

        case StateOfWall.Up: return(StateOfWall.Down);

        case StateOfWall.Down: return(StateOfWall.Up);

        default: return(StateOfWall.Left);
        }
    }
コード例 #2
0
    public static StateOfWall[,] Create(int width, int height)
    {
        StateOfWall[,] maze = new StateOfWall[width, height];

        StateOfWall initial = StateOfWall.Left | StateOfWall.Right | StateOfWall.Up | StateOfWall.Down;

        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                maze[i, j] = initial;
            }
        }

        return(ApplyRecursiveBacktracker(maze, width, height));
    }