The three rules of Ruby Quiz: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have passed from the time on this message. 2. Support Ruby Quiz by submitting ideas as often as you can: http://www.grayproductions.net/ruby_quiz/ 3. Enjoy! -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= by Glenn Parker GOAL: Given a cryptogram and a dictionary of known words, find the best possible solution(s) to the crytogram. Extra points for speed. Coding a brute force solution is relatively trivial, but there are many opportunities for the clever optimizer. A cryptogram is piece of text that has been passed through a simple cipher that maps all instances of one letter to a different letter. The familiar rot13 encoding is a trivial example. A solution to a cryptogram is a one-to-one mapping between two sets of (up to) 26 letters, such that applying the map to the cryptogram yields the greatest possible number from words in the dictionary. Both the dictionary and the crytogram are presented as a set of words, one per line. The script should output one or more solutions and the full or partial mapping for each solution. An example cryptogram and solution are provided, below. Three unsolved cryptograms given. Each cryptogram uses a different mapping. The cryptograms may contain a few words that are not in the dictionary, e.g. an author's name is commonly appended to quoted text in cryptograms. Many published cryptograms also contain punctuation in plaintext as a clue to the solver. The cryptograms below contain no punctuation, since it just confuses dictionary-based searches. The dictionary I used was 2of4brif.txt, available as part of the 12Dicts package at http://prdownloads.sourceforge.net/wordlist/12dicts-4.0.zip. Given the size of the file (~ 1Mb), it is not included in this message, but I do think it would be best if participants all used the same dictionary. EXAMPLE: gebo tev e cwaack cegn gsatkb ussyk SOLUTION: mary had a little lamb mother goose in: abcdefghijklmnopqrstuvwxyz out: trl.a.m...e..by...ohgdi.s. Note: dots in the "out" side of the mapping indicate unused input letters. CRYPTOGRAMS: ----- crypto1.txt ----- zfsbhd bd lsf xfe ofsr bsdxbejrbls sbsfra sbsf xfe ofsr xfedxbejrbls rqlujd jvwj fpbdls ----- crypto2.txt ----- mkr ideerqruhr nrmsrru mkr ozgcym qdakm scqi oui mkr qdakm scqi dy mkr ideerqruhr nrmsrru mkr zdakmudua nja oui mkr zdakmudua goqb msodu ----- crypto3.txt ----- ftyw uwmb yw ilwwv qvb bjtvi fupxiu t dqvi tv yj huqtvd mtrw fuw dwq bjmqv fupyqd