'Perlin worms for 2D cave generation

I've been trying to make a 2D Minecraft-like game. I'm to the point where I've done the terrain generation, but I want to do cave generation now. I've experimented with Perlin noise, but found that the best I could get to were long connecting caves that never have dead ends. I then found out about perlin worms and realized it would be able to generate worm like caves.

I tried to do research on perlin worms, but there barely seems to be anything on it. Could you make a perlin worm function from a perlin noise function? If so, can you make it so that you could input a coordinate pair and it would return a value for that position like perlin noise functions?

Thanks in advance. All I need are ideas :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source