From: Ruby Quiz Date: 2007-06-08T21:46:56+09:00 Subject: [QUIZ] Mexican Blanket (#127) 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.rubyquiz.com/ 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= by Scott Prager I'm looking at this blanket my dad got in Mexico, and I'm noticing that it has an interesting gradient. There are two colors (c1 and c2) and the outside c1 is 5 stitches wide, then a 1 stitch c2, 4 stitches c1, 2 stitches c2... It looks something like this: RRRRRBRRRRBBRRRBBBRRBBBBRBBB RRRRBRRRRBBRRRBBBRRBBBBRBBBB RRRBRRRRBBRRRBBBRRBBBBRBBBBB RRBRRRRBBRRRBBBRRBBBBRBBBBBY RBRRRRBBRRRBBBRRBBBBRBBBBBYB BRRRRBBRRRBBBRRBBBBRBBBBBYBB RRRRBBRRRBBBRRBBBBRBBBBBYBBB RRRBBRRRBBBRRBBBBRBBBBBYBBBB RRBBRRRBBBRRBBBBRBBBBBYBBBBY RBBRRRBBBRRBBBBRBBBBBYBBBBYY BBRRRBBBRRBBBBRBBBBBYBBBBYYB BRRRBBBRRBBBBRBBBBBYBBBBYYBB RRRBBBRRBBBBRBBBBBYBBBBYYBBB RRBBBRRBBBBRBBBBBYBBBBYYBBBY RBBBRRBBBBRBBBBBYBBBBYYBBBYY BBBRRBBBBRBBBBBYBBBBYYBBBYYY BBRRBBBBRBBBBBYBBBBYYBBBYYYB BRRBBBBRBBBBBYBBBBYYBBBYYYBB RRBBBBRBBBBBYBBBBYYBBBYYYBBY RBBBBRBBBBBYBBBBYYBBBYYYBBYY BBBBRBBBBBYBBBBYYBBBYYYBBYYY BBBRBBBBBYBBBBYYBBBYYYBBYYYY BBRBBBBBYBBBBYYBBBYYYBBYYYYB BRBBBBBYBBBBYYBBBYYYBBYYYYBY RBBBBBYBBBBYYBBBYYYBBYYYYBYY BBBBBYBBBBYYBBBYYYBBYYYYBYYY BBBBYBBBBYYBBBYYYBBYYYYBYYYY BBBYBBBBYYBBBYYYBBYYYYBYYYYY It goes on and on like that and when one color ends, another begins. When two sets of gradients meet, there is a thick separator. Two gradients don't always meet at the same color, but their opposite borders are usually the same. (ex: black-to-yellow |separator| white-to-black) There is also the occasional gradient of thick bars of equal length; ex: |green|-|yellow|-|red|. It looks like this: http://www1.istockphoto.com/file_thumbview_approve/2544046/2/ So the challenge is to make a pattern generator to generate the patterns as seen in the ASCI and picture. It should, or rather NEEDS to, contain the Mexican flag as it is respectful to the culture where this challenge comes from. For extra credit, try to put them on a blanket of 200x100 pexels. And if you really need extra credit to graduate, make the patterns symmetrical, however make the colors in the patterns NOT symmetrical (ex: WWRW middle OBOO).