Re: Re[2]: Hash table formula - now more of a tre 14:29:49 -0400"

From: d. hall (dhall@APK.NET)
Date: 08/12/97


// thus on Tue, 12 Aug 1997 14:29:49 -0400, angus virtually wrote:

me> Or else I'd scrap that and use a mini- MD5 scheme. =)

With Innd, it's been proposed that in order to create a sufficiently and
relatively "uniform" hash scheme, using md5 to create a unique enough hash
key for the control.cancel newsgroups.

angus> *tilts his head to the side* care to give an example of how this
angus> would look. (the ** part) I was really pleased with the fact that
angus> you could have 2 words starting with the same letters but widely
angus> separated.

I'm doing most of this from memory.

**command_list

 [a] - [assist] - [at] - [act]
  |
 [b] - [buy] - [backstab]
  |
 [c] - [cast] - [clear] - [consider]
  |
 [d] - [down] - [date]

etc...

When referencing *command_list, you would get the element within the
[a .. d], which points to the array of structures for that character and or
letter.  **command_list actually points to an elemenet within the array
pointed to by the original array.

command_list is set to above.

*command_list == [a]
**command_list == [assist]

command_list++

*command_list == [b]
**command_list == [buy]

(*command_list)++

*command_list == [b]
**command_list == [backstab]

It's also nice if you keep your commands within an ascii text file which
can be editted and reloaded at game time.  This way when parsing the file,
you can have it go through and create the list dynamically, you'll need two
parameter, though.  Maximum number of starting characters and the length
(or number of element) within each character.

Using the above example, when parsing the file, there are 4 elements within
the index'ing array.  The [a] element has 3 length, [b] element a 2 length,
so on and so forth.

typedef struct command_type CmdType;

command_list = (CmdType **) malloc (sizeof (CmdType *) * X + 1);

// in this case X would be 4, the +1 is to add the null space.

then for each element of command_list:

*command_list = (CmdType *) malloc (sizeof (CmdType) * X + 1);

// where X is the length for that letter

So on and so forth...  it's easier in implementation than explaining in
english.

d.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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