Gday everybody,
I'm just trying to program the so called "life game". Forgot who invented it, but I find it pretty interesting. Please DO NOT post any links related to programming the game, as it would destroy my motivation ;)
The essential part of it is the playground. I need a two dimensional array, which is expandable in all directions.
E.g. I've got an array with 10*10 Fields in the beginning. I need to be able to add new fields in the direction of array[-1][-1] as well as in the direction of array[11][11] at the same time. I even need to be able to add a new item to field array[-1][10] or array[10][-10]. I need to be able to access the array into all possible 2D directions.
By the same time of writing this post, I just got an idea: What about having four arrays pointing towards all directions NORTH, EAST, SOUTH and WEST? Just having all arrays put next to each other, virtually pointing in the specified direction. Just like the example below. All Arrays put together form my playground. Would it be efficient, or are there simpler ways?
[][][] | [][][]
[][][] | [][][]
[][][] | [][][]
_______|_______
[][][] | [][][]
[][][] | [][][]
[][][] | [][][]
Thanks.