Please Forward: Ruby Quiz Submission

From: James Koppel <>
Date: June 11, 2007 9:20:42 PM CDT
Subject: Please Forward: Ruby Quiz Submission

The description and ASCII art perfectly explained the problem. Apparently, however, the photo has the sole purpose of being confusing by clashing with the description and the ASCII. After much pondering over how to interpret the description and get it to agree with the photo with no result, I just decided to ignore the photo (and the clause about the separator, which is apparently invisible on the ASCII...), and create this solution.

str = "RBYBGYGGYGBYBR".scan(/../).inject("") { |s, cols|
  1.upto(5) {|n|
  n2nd = s.length / 30 % 2 == 0 ? n : 6-n
      s << (cols[0,1]*(6-n2nd))+(cols[1,1]*n2nd)}

50.times {|n| puts str[n,50]}

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.


Begin forwarded message: