Hi,
i asked a similar question a coupe of days ago, and it could have been you that gave me an idea to work on - but i deleted post by mistake.
its part of a turnbased game. x + y is the position of the current
unit, in a grid eg 10x10. Then each surrounding square changes graphic and attributes to allow movemement to that square. try..catch.. stops arrayoutofbounds exceptions. However, the above code is for one square each way. If i wanted 5 squares each way, without an algorithm, i would need to type out every single square, and have a try..cathc for every square also!
Seamus