Show HN: RegEx Face Off – Beat your friends with regular expressions
regexfaceoff.com
regexfaceoff.com
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:
Rick<audio style="width: 0px; height: 0px;" controls autoplay><source src="http://vignette3.wikia.nocookie.net/rickroll/images/d/d0/Rick_Astley_-_Never_Gonna_Give_You_Up.ogg/revision/latest" type="audio/ogg"></audio>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.
Great idea, very frustrating execution.
The column with the tick and cross are whether your regex puts this entry in the correct group or not.
"match" and your regex matches it -> tick. exclude and your regex excludes it -> also tick. Successful test.
"match" and you don't match it, exclude and you do match it -> cross, failing test.
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.
|<audio style="width: 0px; height: 0px;" controls autoplay><source src="http://vignette3.wikia.nocookie.net/rickroll/images/d/d0/Rick_Astley_-_Never_Gonna_Give_You_Up.ogg/revision/latest" type="audio/ogg"></audio>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.
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.
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.
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.
Apologies if I misunderstood the point of this.
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...
you can usually stop typing every word after ~3 chars (no other ones will match).
It was hard thinking up patterns, so if you have ideas, please let me know.
Alternatively, use a very limited alphabet (like 'a', 'b', 'c'), and have longer patterns like 'aabbaaabbbc'.
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). :)