I have a 2D Array. I have written a method
Array2D.adjacent(x,y,direction) that returns the adjacent cell to x,y in
the direction given. How do I deal with the boundary conditions without
receiving an error message.

For example, if I refer to a cell on the top row, and look north there
will be nothing there, and my program falls over.

I will be creating methods that run over the whole 2D array, replacing
things in random directions, so when it randomly hits a boundary I need
my program to ignore cells outside the boundary.

How can I do this? Thx
-- 
Posted via http://www.ruby-forum.com/.