Represent grid as an object
What's reasonable way to represent a grid in terms of an object? It's part of a two dimensional graphic programming exercise where at the center of the grid is "me".
The object needs to be scalable up to 20,20.
So if I have a 3,3 grid I need to know that I am in grid 1,1 (center) and that 0,0 is lower right. And if I have an grid of 5,5 I need to know t开发者_StackOverflow社区hat 2,2 is the center and 0,0 is the center.
If you need a reduction of the complexity and another order of the grid you can use space-filling-curve like a z-curve, a hilbert-curve, a peano-curve.
精彩评论