Assuming you can actually detect success, that's not really that big of a problem. You can do it in 11 lines by appending:
for(i in 1e7){g=do-generation(g);if(worksp(g)) return g}
Assuming you can actually detect success, that's not really that big of a problem. You can do it in 11 lines by appending:
It'll take while, but the claim is that it optimises on lines, not on runtime.