From: Gregory Seidman Date: 2006-01-21T00:59:24+09:00 Subject: Re: [QUIZ] Grid Folding (#63) On Fri, Jan 20, 2006 at 10:57:03PM +0900, Ruby Quiz wrote: [...] } The input to the function is a string containing the characters "T" (the } top edge folded down to the bottom edge), "B" (bottom up to top), "R" } (right to left) and "L" (left to right). Not every combination of those } will be valid, so make sure you verify your input. [...] } To help clarify, here's a 2x2 example. } } +-+-+ } |1|2| } +-+-+ } |3|4| } +-+-+ } } fold("RB") => [3, 4, 2, 1] } fold("TL") => [3, 1, 2, 4] } fold("LR") => raise exception for invalid input Assuming it is only composed of [LRTB], is there any way in which the string can be invalid other than too many folds in a particular dimension? --Greg