--001636c5a72e790d67046d70b2d3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello, Here's my solution, it works also with grid with different sizes but it does not check the adjacency of the shape parts. http://github.com/sandropaganotti/Ruby-Quiz-Repository/blob/222c931fcca22e1b89ae764efaa463b376b90eb9/211_plot_the_shape.rb Sandro On Fri, Jun 26, 2009 at 7:30 PM, Daniel Moore <yahivin / gmail.com> wrote: > - - - - - - - - - - - - - - - - - - > > The three rules of Ruby Quiz: > > 1. Please do not post any solutions or spoiler discussion for this > quiz until 48 hours have elapsed from the time this message was > sent. > > 2. Support Ruby Quiz by submitting ideas and responses > as often as you can! > Visit: http://rubyquiz.strd6.com/suggestions > > 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. > > RSS Feed: http://rubyquiz.strd6.com/quizzes.rss > > - - - - - - - - - - - - - - - - - - > > ## Plot the Shape (#211) > > Kvetha Rubyists, > > This week's quiz was submitted by Alan at > http://rubyquiz.strd6.com/suggestions > > Somewhere on a 10x20 grid is a 10 block shape. The shape parts are all > adjacent, either horizontally, vertically or diagonally. > > Write a simple algorithm that will list the co-ordinates of the 10 > parts of the shape. Try to minimize lookups to the grid. > > Here is an example shape to get started (you may need to copy into a > monospaced font): > > 0123456789ABCDEFGHIJ > 0.................... > 1.................... > 2.........@@......... > 3........ / ........... > 4........@@@@@....... > 5............. / ...... > 6............ / ....... > 7.................... > 8.................... > 9.................... > > > Have Fun! > > -- > -Daniel > http://rubyquiz.strd6.com > > P.S. Submitting quiz ideas is fun and easy. Visit > http://rubyquiz.strd6.com/suggestions to find out more! > > --001636c5a72e790d67046d70b2d3--