I hope you all had fun at the hack session last night. It would be great to hear about everyone's solutions and how they found the exercise overall. I didn't participate on the night, but to get the ball rolling, here's the code I wrote whilst preparing the quiz:
https://gist.github.com/tekin/a2fb80e4785029cfcf63 Of course I had the benefit of writing this whilst not under any time-pressure so was able to take my sweet time and make it all neat and tidy. In hindsight it might have been better if I'd time-boxed my effort to get something closer to the hacked together code I would no doubt have come up with if I was participating on the night itself. The CaesarCracker is not very sophisticated and will fall over in a number of situations. For a start, it won't be able to crack a word that is in plural form as the wordlist at /usr/share/dict/words only contains singular forms. There's also a chance it'll return an incorrect result if there happens to be more than one shift value that results in a valid word. But for the purposes of this quiz, it was good enough to crack the encrypted keyword. As is often the case with Ruby, a bunch of complicated code in both the cracker and the ciphers themselves was made simpler when I found a method that did exactly what I wanted: Array#rotate <http://ruby-doc.org/core-2.2.0/Array.html#method-i-rotate>. How'd everyone else get on? Tekin -- You received this message because you are subscribed to the Google Groups "North West Ruby User Group (NWRUG)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. Visit this group at http://groups.google.com/group/nwrug-members. For more options, visit https://groups.google.com/d/optout.
