
Regular Expression Crossword Puzzle - gregable
http://gregable.com/2015/12/regular-expression-crossword-puzzle.html
======
overlordalex
Here's a nice site for these:
[https://regexcrossword.com/](https://regexcrossword.com/)

The default puzzles are a bit basic, but there's a large amount of player-
created puzzles that are great.

~~~
padolsey
I love these! I tried automating the creation of them a while ago[1]
(refreshing the page creates a new one). I should probably revisit it though
as the generated puzzles aren't tricky enough..

[1] [http://padolsey.github.io/redoku/](http://padolsey.github.io/redoku/)

------
jgeralnik
The original source for this puzzle was the 2013 MIT Mystery Hunt:

[http://www.mit.edu/~puzzle/2013/coinheist.com/rubik/a_regula...](http://www.mit.edu/~puzzle/2013/coinheist.com/rubik/a_regular_crossword/index.html)

~~~
gregable
Awesome, thanks! I've added attributions on both the blog post and the puzzle
page. It's a really fun puzzle, the author of it definitely deserves credit.

~~~
schoen
Thanks for updating your post with the attributions!

------
anon4
One note about the interface - the rotation arrows are very confusing. You
should always put the curve on top, rather than on bottom, since most people
think of rotation directions based on the movement of a point on the top of
the arc. Additionally, the left arrow rotates right, while the right arrow
rotates left.

~~~
gregable
I reversed the order of the arrows, but I'm not sure about flipping the
glyphs. Those are the standard unicode glyphs for rotation arrows, I didn't
want to use any images on the page. I suppose I could use CSS to invert them.

------
almost
I had a lot of fun writing a program to solve this puzzle last year. I wrote
about it here: [http://almostobsolete.net/regex-
crossword/part1.html](http://almostobsolete.net/regex-crossword/part1.html)

The Haskell code is also on GitHub

------
mrcactu5
Sites like [http://regexper.com/#.*OXR.*](http://regexper.com/#.*OXR.*) help
interpret the clues without solving the puzzles

------
beerbajay
I solved this a while back. It's a bit challenging, but mostly due to the fact
that the clues aren't really completely determining the solution, so you can't
deduce each square like you can in e.g. sudoku. You have to make some guesses
and then backtrack if they're wrong.

~~~
Apanatshka
It took me a while, but I solved it without any guessing+backtracking.

~~~
shimo5037
Same. Definitely doable. It did take me a guesstimated 1.5h though.

------
rileymat2
Assuming a puzzle had a single solution: How computationally hard would it be
to prove that one solution was the only solution?

------
osoba
Could you move the puzzle on amazon a few (20?) pixels to the right, the.
_(.)(.)(.)(.)\4\3\2\1._ regex gets cut off on the left when you rotate
[http://i.imgur.com/qcG1kav.png](http://i.imgur.com/qcG1kav.png)

~~~
gregable
I added 20 pixels of left margin to the puzzle, let me know if that helps. I
think it depends on screen resolution, I'm not seeing the same thing. If it's
still causing you trouble Cntrl +/\- should work for resizing the page too.

~~~
osoba
It's fixed now. Thanks

------
aurbano
After spending most of the morning solving it manually I was thinking about
how an algorithm might work for this.

Perhaps converting each regex into a DFA, but there are too many dependencies
with all the other regexes. Any ideas on how to avoid brute forcing it?

~~~
malisper
This kind of puzzle falls under a general class of problems called Constraint
Satisfaction Problems. Sudoku puzzles, map coloring, and cryptarithms are all
examples of CSPs. A CSP is defined by a bunch of variables, each of which can
take on some values in their _domain_ (In this case each cell is a variable,
and initially their domain is all 26 letters.) and a group of arbitrary
_constraints_ over the variables (the regexes).

One method of solving a CSP is to keep a set that initially contains all of
the variables. On each iteration you choose a variable from the set and remove
all values in its domain that are impossible given the constraints containing
the variable and the domains of the other variables in those constraints. Then
you add all of those other variables to the set because they are now
restricted more than before. You keep doing the above until you get stuck
(which may or may not happen). You then start guessing. There are a bunch of
heuristics about how you should choose which variable to guess (eg the
variable with the smallest domain). Once you have made your guess, you then
add all of the variables back to the set. If you find out the puzzle is
impossible, you backtrack to the last guess you made. I believe there are ways
you can determine which guess was the problem and immediately backtrack to
there.

~~~
sah2ed
What books come highly recommended for learning CSP?

~~~
beerbajay
I wrote my master's thesis in Constraint Programming. The textbook for my CP
course was Apt's "Principles of Constraint Programming"[1], but I have to
admit to barely using it. Most of the books and "introductions" to CP which
I've read have been lacking in either rigor or clarity; many important details
are glossed over, partly I think, because of CP's development from other kinds
of optimization/satisfaction programming. When learning, I mostly used lecture
notes from Christian Schulte (from KTH in Sweden) and Pierre Flener (from
Uppsala University, also in Sweden). I can unfortunately not find these
accessible online at the moment.

[1] [http://www.amazon.com/Principles-Constraint-Programming-
Krzy...](http://www.amazon.com/Principles-Constraint-Programming-Krzysztof-
Apt/dp/0521125499)

------
pan69
How about that for a CAPTCHA. :)

~~~
kaoD
CAPTCHAs should be easy to solve for humans and hard for computers, not the
other way around :P

------
phamilton
I did this puzzle with a coworker and regular "commits" ( photocopy and add a
version number ) was pretty useful. We botched it more than once and it was
nice being able to revert.

------
Drdrdrq
Great puzzle, too bad it doesn't have a single solution...

~~~
gregable
I'm fairly sure there is only one solution.

