Re: NSDictionary
Re: NSDictionary
- Subject: Re: NSDictionary
- From: Bob Savage <email@hidden>
- Date: Tue, 29 Jan 2002 19:06:54 -0600
on 1/29/02 5:53 PM, John C. Randolph wrote:
>
>
> What's the max size for NSDictionary/NSMutableDictionary? How many
>
> rows/records and columns/fields?
>
>
Good question. I don't think there's a hard limit. I've had
>
NSMutableDictionaries with thousands of entries, but I've never
>
tried pushing it till it broke.
>
>
What are you proposing to store in this very large dictionary?
>
Aagh! I never thought of this. 8-O I might need something several orders of
magnitude larger (e.g. 4,194,304 entries). I was going to use this as a
place to store spaces in a game I am working on. It is a strategy game
(based on a hexagonal grid) and I am storing the hex objects in a dictionary
with their location (x, y) as the key. It is very common for me to need to
look up a hex based on location, so this is quite ideal. Each hex has a
handful of properties: the location (NSPoint), elevation (float), an array
of occupants (id), and a terrain (id).
There is no guarantee that the field of hexes is continuous (meaning that
many to most are likely missing when the board is loaded due to imperfect
player knowledge of the world), so saving hexes into a multidimensional
array is not an effective means of getting at the hexes by location.
If I am doing something very wrong here, please let me know now, so I have a
chance to fix things before it becomes too late.
Bob