Re: Just wondering, anyone as insane as I?

From: Wout Mertens (Wout.Mertens@rug.ac.be)
Date: 04/12/96


Eric Green wrote:

> I did a very similar thing recently.  I changed world to an array of room
> pointers.  Ch->in_room was left the same.  Converting was just a matter of
> changing world[i].x to world[i]->x, and adding some checks of "if
> (world[i])" a few places.  I kept real_room() around, as a quick check for
> array bounds and room existance (and simpilfies it if i ever want to
> increase the maximum number of rooms and switch to a hash table).

so you do realloc when you want to add a room?

> I probably will use a hash table for some other structures, but because of
> the frequency the room numbers are used, i wanted to keep the hash function
> at hash(x) = x.

I was wondering, what /is/ the hashfunction to use on an array like this?
suppose you don't want linear hashing like you do but rather a less 
memory-intensive solution?

Michael B. did one... Michael? What did you use? hash(x) = x % 100 ? 
(since every zone has max 99 rooms?)

And another thing, someone mentioned splay trees? Something like that it 
was a binary tree, but when you found a room, it was moved upwards in 
the tree? But how do you find it back later?

Just wondering,

Gekke Eekhoorn of BUG.



This archive was generated by hypermail 2b30 : 12/18/00 PST