So, my wife bought me one of those Page-a-Day Calendars for XMas. Last year was a Car and Driver calendar. This year it was the Mensa Puzzle calendar. The puzzles are pretty interesting, although sometimes I have absolutely no idea what the solution is.

Anyway, one day the puzzle was a simple code where each letter on the initial string represented another letter. The puzzle gave the first translation, H=S.

I began to write the puzzle out, figuring I'd try a few assumptions and play around with it a bit. However, I quickly realized that solving the puzzle would get messy.

So, I wrote a simple ColdFusion script that would display the original script along with letters it knew how to translate. As I made guesses (i.e., F is probably X) I could modify the code, run it, and see if it made sense visually.

This is the original code I wrote with only the original hint:

<cfset tran = structNew()>
<cfset tran["h"] = "S">
<cfset str = "BLF NRHH GSV UZXGH GSZG ZIV RM GSV URMV KIRMG">


<cfloop index="x" from=1 to="#len(str)#">
   <cfset c = mid(str,x,1)>
   <cfif c is " ">
      <cfset c = "&nbsp;">
   </cfif>
   <cfoutput>#c#</cfoutput>
</cfloop>
<br>
<cfloop index="x" from=1 to="#len(str)#">
   <cfset c = mid(str,x,1)>
   <cfif structKeyExists(tran, c)>
      <cfoutput><font color="red">#tran[c]#</font></cfoutput>
   <cfelse>
      <cfif c is " ">
         <cfset c = "&nbsp;">
      </cfif>
      <cfoutput>#c#</cfoutput>
   </cfif>
</cfloop>

I quickly realized that the GSV in the string was probably THE, so I added:

<cfset tran["g"] = "T">
<cfset tran["s"] = "H">
<cfset tran["v"] = "E">

I then simply made a few more guesses, a few more edits, and the translation soon became very easy. By the way, if you want to solve it yourself, the words translate to a phrase the completes this rhyme:

"You read the ads, but if you don't squint,"