Regex Crossword
regexcrossword.com
regexcrossword.com
Right now, it works using a logic programming engine (core.logic, essentially miniKanren), generating a bunch of strings that match the regex, and then applying them as constraints.
If I were to improve it, I'd parse the regex, walk the parse tree, and assign constraints that way. (There's already a regex parser in there: that's how the string generation works.) That was my first thought, but that's more complex than what I want to tackle before work :)
Right now there's a bug where if e.g. a regex AB|CD will get applied character-wise, so it might erroneously try AC or BD. The way to fix that is to make sure the answers actually match the regex all the way at the end.
Using a constraint engine has the cool feature that it can show you multiple answers if they exist. (That's not true for my current implementation, because the string generation is randomized, so there's no guarantee it will visit each possible string.)
Someone else has pointed out that there are a lot of clues in the titles, e.g. that the answers are palindromes. That would be easy to add:
(map (fn [vars] (l/== vars (reverse vars))) (concat rows cols))
(Read: "for each row and col, create a constraint that the row/col must be equal to itself reversed".)The core idea was for each cell, keep track of a list of possible letters that can go there. Initially you start with the full alphabet, and as the solver repeatedly narrows down the list for each cell as it gets closer and closer to completion. To hone in on the solution, the solver would iterate through each regex and see what characters could go in that row or column to match the regex.
For example if you have the regex "(a|b)" against an cell, you can constrain the list of possible values to the cell to just the letters "a" and "b". For a slightly more complex example, if you are matching a regex "(abc|def)", and you know the middle character has to be an "a" or a "b", you know the string in that row or column is "abc". By repeatedly checking each regex, the solver gets closer and closer to the solution until it eventually solves it.
Of course there's a chance the solver will get stuck. As a last resort, you can always resort to backtracking. I wound up finding implementing backtracking wasn't necessary since the approach I mentioned above was enough to solve every puzzle I threw at the solver.
[0] https://en.wikipedia.org/wiki/Constraint_satisfaction_proble...
I did the somewhat bruteforcy generate-strings-and-learn-from-that way, instead of working off the parse tree. The latter is clearly more efficient, but also not something I can implement in <1h before work -- and it has the logic engine in the center, meaning it's not a dead end if I want to pick it up again :-)
No, that's a lie. No need for identification in order to save progress, you can use: cookie, browser storage, etc.. for that.
Please be honest about why you are using social media for login. Because when I login with Facebook for example, you can see a large portion of my Facebook profile and depending on the plan you have way more than that.
Anyway the Idea is good and it is really fun to solve.
One way would be to auto-generate accounts and display some random identifier to keep. Or maybe just offer e-mail to which they would send you a login link... There are other options but login with OAuth is not the worst.
Without speaking for Regex Crossword (I'm in no way affiliated with them):
I suspect the reason may at least in part be security. Passwords are dangerous to keep around, hard to handle, computationally expensive if done right, and if an attacker gets at the database, people get angry. A social network provider (especially the options here, Facebook, Google, Twitter, GitHub and Windows Live) is much more likely to get security (against third party attackers) a lot more right.
Better to just save to a cookie.
1) It's not clear which flavour/implementation is needed. I was using https://regex101.com/ to check until the puzzle where /+ is used, which that site claims is invalid in JS and PHP but OK in Python.
2) It would be great if filling a cell automatically moved you to an adjacent cell, as in most (regular) crossword apps.
not sure about the question you hit a snag, can you post the details here? you might get your doubt cleared
Pasting that into regex101, with flavour Ecmascript, yields "Pattern Error" (rightly, since forward slashes enclose patterns, and thus need to be escaped).
and yeah, agree with you, this should either be escaped or some explanation added regarding delimiters
Don't do that people. Just. Don't.
Keep regexes simple and stupid! Remember other people will have to read them someday.
Perhaps I have some time in 2-3 weeks to develop it further, does anybody have advice on what to include?
https://play.google.com/store/apps/details?id=de.chagemann.r...
Previous discussion: https://news.ycombinator.com/item?id=8674039
https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_th...
If you click Validate it'll shake and turn red, though you can skip ahead all you want, you want it to turn green and add a checkmark next to the title.
I guess all I showed was that if you don't want to learn, you're not gonna learn.
I'm no regex beginner but this overall presentation is pretty confusing.
If you find the interface confusing, start with the tutorial levels which begin with a single character solution and progress to larger solutions. Each cell is clearly meant to be one character in a string, with the row/column being the entire string.
surprised that this resource wasn't mentioned in a recent thread [2] about regex
After that, keep regex101.com handy for testing and checking your regexes.
When done, go to http://alf.nu/RegexGolf to sharpen up your skill!