In an earlier post, I mentioned how I used CF to solve a simple puzzle. I was lazy again today and decided I would use it to solve another puzzle. This time the puzzle was a 4x4 grid with the letters W, X, Y, and Z. Each row had a different combination of letters with a sum at the end. So for example, W + X + Y + Z = 17 and W + Z + Z + W = 16. You had to solve for Y + X + X + Y. So, being the lazy person I am, I used a simple script:

<cfloop index="x" from=1 to=8>
<cfloop index="y" from=1 to=8>
<cfloop index="w" from=1 to=8>
<cfloop index="z" from=1 to=8>
<cfif (w + x + y + z is 17) and
          (z + 2*x + y is 19) and
          (z + 3*x is 18) and
          (w + 2*y + w is 14)>

             x=#x#, y=#y#, w=#w#, z=#z# is GOOD

I used 8 as a max as all the sums were below 20 and I figured it would be a safe assumption. Running the code took about one second and quickly spit out the solution:

x=4, y=5, w=2, z=6 is GOOD

I then solved for Y + X + X + Y to get 18. Once again CF saves the day!