From: James Edward Gray II Date: 2006-08-16T07:04:33+09:00 Subject: Re: [QUIZ] Newbie doubts about the quiz On Aug 15, 2006, at 3:49 PM, Marcelo Alvim wrote: > 1) I could create a class that extends Array, or encapsulates one, and > define the #[] and #[]= methods. Then those methods would check the > negative indices and return nil if they were negative. I think this solution would work out fine. Others have given you great ideas as well. Here's a validation method used in David Tran's solution to verify that the indices selected are good: def valid(x, y) x >= 0 && x < @size && y >= 0 && y < @size && !@board[x][y] end See how it ensures they are between 0 and @size? It also checks that the @board is nil at x, y. Hope that helps. James Edward Gray II