On Thu, 23 Sep 2004 08:01:00 +0900, Warren Brown wrote:

> Graham,
> 
>> [Snipped Case Statement explication]
>
>     This is a very ambiguous question, but I think the answer to "what's
> the fastest" is going to be testing each of the eight cells individually. 
> For example:
> 
> cells_left = [
>   cell[x - 1][y - 1],
>   cell[x    ][y - 1],
>   cell[x + 1][y - 1],
>   cell[x - 1][y    ],
>   cell[x + 1][y    ],
>   cell[x - 1][y +  ],
>   cell[x    ][y + 1],
>   cell[x + 1][y + 1],
> ].compact
> 
>     I hope this helps.
> 
>     - Warren Brown

I think that this is dangerous if x or y are equal to 0. In this case
cell[0 - 1][y - 1] returns cell[width - 1][y - 1] and not nil.

regards,

Brian

-- 
Brian Schröder
http://www.brian-schroeder.de/