function p.__get_is_solid() return false end
function p.__get_tex() return "" end

function p.__main()
    set_default_block("e")
    
    --Creating the maze.
    maze_start()

    for x = 0,15,2 do
    for y = 0,15,2 do
        maze_add_vertex(x,y,7)
        set_pos(x,y,7,"s")
    end end

    for x = 0,15,2 do
    for y = 0,15,2 do
        if (x + 2 <= 15) then
            maze_add_edge(x,y,7, x+2,y,7)
        end
        --See what happens if this is taken out.
        if (y + 2 <= 15) then
            maze_add_edge(x,y,7, x,y+2,7)
        end
    end end

    maze_end()
    --The graph for the maze has not been created.
    --(The graph is a minimal spanning tree).

    --An edge (between two vertices) is called "open"
    --if it is in the final minimal spanning tree.
    for x = 0,15,2 do
    for y = 0,15,2 do
        if (x + 2 <= 15) then
            if maze_edge_open(x,y,7, x+2,y,7) then
                set_pos(x+1,y,7,"s")
            end
        end
        if (y + 2 <= 15) then
            if maze_edge_open(x,y,7, x,y+2,7) then
                set_pos(x,y+1,7,"s")
            end
        end
    end end

    --Coloring dead ends black.
    for x = 0,15,2 do
    for y = 0,15,2 do
        if maze_num_edges_from_vertex(x,y,7) == 1 then
            set_pos(x,y,7,"r_black")
        end
    end end

    --Finding the position farthest away from (0,0,7).
    --print("DOING TRICKY PART")
    set_pos(0,0,7,"r_green")
    local sources = {}
    sources[1] = {x=0, y=0, z=7}
    local pos = maze_deepest_vertex(sources)

    set_pos(pos.x, pos.y, pos.z, "r_brown")
end
