# start with our cyphertext $orig = < # ctrrh oikda snsnc asytt bspia gasel # odwnh foewc dwigg rtemu avdhi eotot # euamf ncasn ctmdh ixter oteud loelb # tuanl hmfoe niren ahmsa nsler rtulo # dwnhf oejaa ktlei stpia gqzye selod # wnhfo ejpia gesyt rrchw tdhic euvim # oh well :) try something else # let's make sub a hash, for easier tweaking $subs = Hash[*sub.flatten] class << $subs def assign(x, y) old = self.index(y) self[old] = self[x] self[x] = y end def display self.keys.sort_by {|x| self[x]}.map {|x| [x, self[x]]}.transpose.map(&:join) end end p $subs def try(*xys) o = $orig.dup xys.each {|xy| x, y = xy.to_s.split(//) x = x.upcase $subs.assign(x,y) } $subs.each {|i, j| o.gsub! i, j} puts puts $chart.map(&:first).join puts $letters.map(&:first).join puts $subs.display puts o.zip($orig) end def method_missing(meth) meth.to_s end # lots of FF - maybe F = e try fe # nope, maybe F = s? try fs # the word 'grey' has appeared :) also 'bepia', suggesting a colour theme try ds # nah try ft # NSA = the? try nt, sh, ae # note "the gray". still pondering all those FFs try ro, fn # R is high-probability too try jy # sorry? try ys, fr # sorry i? try oi