function b = hasExploredNeighbor(explored, x, y)
b = 0;
    if(x+1 < 5)
        if(explored(x+1,y) == 1)
            b = 1;
            return;
        end
    end
    if(x-1 > 0)
        if(explored(x-1,y) == 1)
            b = 1;
            return;
        end
    end
    if(y+1 < 5)
         if(explored(x,y+1) == 1)
            b = 1;
            return;
        end
    end
    if(y-1 > 0)
         if(explored(x,y-1) == 1)
            b = 1;
            return;
        end
    end
    
end