I keep getting an index out of bounds error and dont know why
<pre><code>    public bool Solve_Maze(int X_Pos, int Y_Pos)
    {
        bool Move = false;

        //Checking if the position isnt on the finish
        if (maze_board[X_Pos,Y_Pos] == 'e')
        {
            Move = true;
            maze_board[X_Pos,Y_Pos] = '+';
            return Move;
        }

        // Check for a wall
        if (maze_board[X_Pos, Y_Pos] == '1')
            return false;

        if (maze_board[X_Pos, Y_Pos] == 'X')
            return false;

        maze_board[X_Pos, Y_Pos] = 'X';

        Move = Solve_Maze(X_Pos + 1, Y_Pos);
        Move = Solve_Maze(X_Pos, Y_Pos + 1);
        Move = Solve_Maze(X_Pos - 1, Y_Pos);
        Move = Solve_Maze(X_Pos, Y_Pos - 1);

        maze_board[X_Pos, Y_Pos] = '+';

        return Move;

    }
</code></pre>

<p>This is the piece of code that is giving me the error</p>

<pre><code>    if (maze_board[X_Pos,Y_Pos] == 'e')
</code></pre>

<p>I am a complete newbie when it comes to programming and was kind of thrown into the deep end with a university assignment so any help would be much appreciated </p>