I'm new here. I wonder how to generate a puzzle using a pattern that I just set. I just implemented one, but the speed is too slow... I found that a program called NP-Generator can generate about this, and was effective. I just took a look for that prorgam source code, but I couldn't understand the backing algorithm.

I want to learn for such generation algorithm. Could you please help me? Thank you!