Bravo! Very neat solution. And, a beautiful demonstration of the fact that the right data structure isn't just important, it's everything.

Also, I like the heavy usage of map and grep. A little harder to read at first (as a programmer who's functional at play, not at work), but very concise.

Question - how does the regex engine not choose a free square in d4 when looking for free squares in d3? I'm guessing it has to do with [\x00-\xFF]*, but I'm not positive as to how that's working ...

We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

In reply to Re: The N-queens problem using pure regexes by dragonchild
in thread The N-queens problem using pure regexes by Abigail-II

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":