Getting back to the original problem, you don't state how big a grid you want. 
But it seems to me that a bitmap like this can be stored very efficiently 
because it has a lot of zeroed out space. Run-length encoding for example 
should compress it very substantially. You might need to roll your own bitmap 
structure to access it and store it since the overhead of arrays and so on 
might be what's killing you.

--Graham


On 05/11/2011, at 12:40 PM, Don Quixote de la Mancha wrote:

> My iOS App Warp Life is an implementation of the Cellular Automaton
> known as Conway's Game of Life:
> 
>   http://www.dulcineatech.com/life/
> 
> The game takes place on a square grid.  Each square is known as a
> "Cell", with the Dead or Alive state of the Cell being indicated by a
> single bit to conserve memory.
> 
> I store the grid as an array-of-arrays rather than a two dimensional
> array.  That is, I have an array of pointers which has the same number
> of elements as there are rows.  Each row is array of unsigned longs,
> with the number of elements being the number of columns divided by
> thirty-two.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to