So I have been trying to wrap my head around a bunch of regular expressions recently. Anyone who has to do this on a regular basis knows that this can be quite...well, lets put it this way it's best not to have the monitor within punching range and sharp objects on the desk are a big no-no.
Anyway, as I am getting more and more involved I am finding some are just fun to play with and some that are so complex and confusing that if they had been around back in the day in Boston they surely would have been burned at the stake for witchcraft. I am even finding a few that are absolutely works of art that I think should be hung in a museum (these expressions tell me "OK. Back away from the keyboard. Time to go outside." ).
I have been writing down a bunch that I think are fun and intriguing and I am thinking of starting a monthly game at the meetings. I will go through a short description of my game and if you guys are interested I will present the first puzzle this month.
So here is the game.
At 10:00am (meeting start time) I will present a message and/or a regular expression.
Message: Stack's Puggles!
Key: 's/g/z/g'
I will present 2 boxes/hats/piles/whatever (I will just say groups). The first is for the decrypted key, the command that matches the appropriate expression, and the explanation behind it. The second is just for the command that decrypts the message. People fill out what they think is the answer and place it into the proper location.
In this example group #1 would have peoples responses like:
Name: stack
Message: Stack's Puzzles!
Command used: sed
The expression searches (s/) the string for the letter g and replaces the matches with z for all instances (/g) of the matching letter.
The second would just have:
Name: stack
Message: Stack's Puzzles!
Command used: sed
After like 30 minutes (hour? don't want it to be too late for those who have to leave early but don't want it to be so early that those who are late can't play either) I randomly draw a name out of the first group. If they get it correct, they win! If not, I draw again.
So why the second group? Because some of the expressions I have dug out are not exactly easy. In fact some of them are downright hard to explain. However, while someone might not be able to explain it, there might be many people who know that the 'sed' command could be used (in this example). So if no one puts an answer in the first group (or the first group all get it wrong), then I draw a name from the second group. Whoever has the right answer there will win!
My thinking is that on the tough ones, the second group gives most people a decent chance to find an answer that decodes the message even if they don't understand why it works. So while they are at a disadvantage for not knowing, they still have a chance if no one else knows either. I am also OK with someone who knows that it is sed, putting their answer in the second group, then taking a wild guess for the first group (where they could be right). I am hoping this will encourage people to play and not discourage an attempt simply because they can't explain the entire expression.
Maybe to encourage people to play I will buy the winner a beer/coke/beverage o' choice (Within reason! No 100$ wines. ).
So, what do you guys think? Anyone willing to step up to the challenge? Or is this a bad idea? Suggestions/Questions/Flames on the rules?
~Stack~
[edit #1] fixed a grammar issue
[edit #2] I have also been posting a bunch of these to my AIM account as away messages when I find them. So for those of you who see/have my AIM account, I am not doing those ones over again. Anyway, I just stumbled across one that is also the same as the example here and that I have used before. So this is a much better example of the puzzle that I would post for those interested.
Message:
zpldgmpeqt dgkupvxzsy pzsexjked
kkwkvhzdod cadmngdzyq qbzruktde
fkojrcgdez vxtkhisgyk zydmoneyz
Key:
's/[^a-cefhilnor-uw ]//g'
If you can't guess the program.... seriously...
The expression should, at least part of the expression should, be evident from my post as well. But does everyone know what the expression inside the match does? This would be a prime example of the detail I would expect in the answers in the first group. Again, comments, questions, (relevant) flames welcome.