Sorry, this will be a negative review. This is easily the most frustrating game I've ever played. I can't test parenthesis because it tells me my time 'ran out' with 45 seconds on the clock. I could barely type 4 or 5 characters.
Edit: There are also XSS issues with the player name, you can execute Javascript in the other player's window. That's not good. I confirmed this since an image I scripted to load via HTML (<img src=) was visited by a Mac user. I use Linux.
I gave up after 2-3 games as well. Time kept running out in three seconds. The semantics are also murky, what do I need to match? The regex doesn't assume ^$, but then do I need to match all intermediate characters? Or just some of them? Or what?
Also, the UI is bad, there's a "match" column with a tick and an x, and you get the tick when you match good regexes and the x when you match bad ones. However, why is the column called "match", then? It should have the tick when a regex matches and the x when it doesn't.
It looks like you just need to match anything in the line, not the whole line. Basically, re.search(your_regex, line) should not return None.
The ticks are just bad UX, because "tick" means pass, "x" means fail and blank also means fail. I know which ones I shouldn't match, just give me a tick on ones that match, good or bad, and I'll figure out the rest.
I got the 5 second timeouts too. Not sure about the viability of the whole game concept. I kinda like the other idea in this thread of giving both players a fixed amount of time, minute or 2, and whoever comes up with the shortest regex that solves it wins. Then you could probably populate it with random words, and let people skip ones they didn't think they could solve. You'd probably get some interesting solutions that way.
My strategy of "capture the last two characters of each input in the accept group followed by $" hasn't failed yet, and is quick to input and requires no thought. Though I wouldn't say I'm practicing any practical RegEx skills doing so. :P
My strategy was ^[].*[^]$ where you first fill in all the first letters of the match words and then all the last characters of the skip group. Works fairly well.
I'm not sure if there is a length limit, but I'm fairly sure I could come up with a vim macro/regex that would allow me to copy the match words and make a (list|like|so) within 45 seconds.
Give the time limit, it would be more fun to automatically let your strategy compete. (maybe with a weight of length vs correctness) Write a function that, given two arrays of words, return the best regex.
> Write a function that, given two arrays of words, return the best regex.
I've actually done that with code-golf in the past. I needed a regex shorter than n that would match what I wanted it to match, so I generated valid regexes up to n length and tested them. A bit brute-force, but eventually saved me one character in the program.
There's definitely a bug in the timing. I feel like it's related to the previous round. Whenever I finished a round early, the next round timed out early.
Also, it should be revamped to always run the full time and award points to the shortest regex. I regularly won rounds with entries like `foo|bar|...` Easy to write, and requiring almost no skill.
This game would be better if it was like a pacman style cave with random letters or whatever, and you had to write a regex to get to the other side without running into an enemy
Some explanation of what to do and what flavor of "regex" syntax is accepted would be good. I'm guessing it's a javascript syntax, but I don't really remember how different it is from pcre, does it have lookahead/lookbehind assertions and all that. Also cloudflare's free ssl doesn't work everywhere, letsencrypt is better at that and also free. Had to open the thing in chrome.
I know people have said this already, but just to update it, the site is still giving 5 second timeouts.
Also when you are playing as anonymous against anonymous, when it says: "anonymous wins" you don't know which of the two anonymous players won. Even if the game says "you won" in the case where it was you, a new player doesn't know that, so it still seems unclear. The anonymous players should be differentiated in some way.. a number tacked on, for example.
Also when the round finishes, it shouldn't just show the regular expression for two seconds and then clear. It should show it for long enough to let me read it and think about it, with the data still displaying, and with a continue button I can click when ready.
Also sadly I think long term this site will have trouble attracting matching players. I expect it to only work during the peak of this exposure on HN. Great idea though.
Finally you should scale down the data so there is less of it to read. You can still make the challenges interesting with well chosen data. And you could add capture and substitution requirements. Again, great idea.
I'm a bit confused - I'm not sure I understand the practicality of this. I do like challenging regexps, but I did not find them here. I thought the point of code games is to practice a skill you could use in real life, but matching random bags of words while avoiding other random groups of words isn't something one would use regexps for.
Not a bad idea but since there's no penalty for long strings I can win pretty much instantly by treating it as a typing test and typing a short (probably-unique) substring from each match separated by |. It'll get me an instant-win but if for some reason it matches some non-matches I make it a little longer. Here's a screen grab of me winning with this super-strategy. on this run for some reason you'll notice there's a bug at the end but normally it just lets me win with no chance for the other person to score. I'm not sure how you could address this... If you keep it this way it just becomes a typing test...
but I didn't "cheat" - I literally typed by hand a regex for the matches but not the non-matches. (Exactly as was asked.) I guess a way to fix this would be to make it like "regex golf" where there is a fixed time but the shortest overall regex wins... It could also be defeated if most substrings of each match were also in the things to avoid. For example if you're supposed to match cat but avoid catch then my strategy would be defeated. I would have to addd ^cat$ -- which wouuld cost me time and characters. :)
Agreed, awesome idea, needs a few bug fixes. Perhaps a description of the game mechanics. Some patterns match inaccurately, and I am also experiencing running out of time with 30+ seconds on the clock, as well as not getting credit for correctly matching patterns. I had fun nonetheless.
This is a little side project I made to learn about Web sockets. Each question consists of a "match" pattern and a "skip" pattern, and then looks up words on wordsapi.com to match those patterns when the question is generated.
It was hard thinking up patterns, so if you have ideas, please let me know.
Cool concept, but I think it'd be infinitely better if the challenges were more realistic/interesting. E.g. matching dates in a particular format, but not another similar format.
i think you should start off with patterns that have less characters (3-5 max), but mix digits and symbols in - at least, in the early game. I found the patterns to be too complex to quickly come up with a regex.
Alternatively, use a very limited alphabet (like 'a', 'b', 'c'), and have longer patterns like 'aabbaaabbbc'.
Really cool, enjoyed playing it for a while. Challenges you to practise your regex golf[1] skills. :)
There seem to be some bugs with the timing mechanisms, probably some JS timeouts aren't properly reset, causing weird game behaviour like running out of time mid-game (the countdown still displaying 10+ seconds). Also correct answers aren't always acknowledged (all icons show the answer to be correct, however it doesn't result in that player winning the game). :)
Edit: There are also XSS issues with the player name, you can execute Javascript in the other player's window. That's not good. I confirmed this since an image I scripted to load via HTML (<img src=) was visited by a Mac user. I use Linux.
POC player name: