Re: [CODE] Priority Queues :: HowTo?

From: Justin Adler (spam@WORLD-DOMINATION.COM.AU)
Date: 02/12/02


Hello All again and George.

  I'm sorry for not explaining the problem at hand.  I was assuming that i
new the exact answer to the problem and was just after the solution, or
clues to the solution.


   The two go hand in hand, so I appologise for my arrogance.


   The problem i face is this.


   I'm trying to store a cache of rooms in some sort of linked list. This
is COMPLETLY INDEPENDANT to the current 'world list' that exists.  I still
wish to use that.  This cache of rooms will be a priority list of rooms. By
this i mean, the most common / accessed rooms will be at the ENTRY POINT of
the list - I assume this is the head of the list. This way, every time i
traverse this cache list, I do not have to trickle deep down into the cache
becuase in theory, the most accessed rooms are near the entry point.


   At first, i'll be using this list more as a reference to see where my
mortals are travelling. And yes, i know there could be other 'logging' ways
for this, but i'd really like to use a priority list (so I can use it in
other areas of the MUD later on).


   Now what does each structure/node in this cache hold? For memory
utilisation, it should probably hold a POINTER to the room. This is fine.
Or even just the VNUMS / RNUMS of the rooms. Memory is not an issue. It's
more the process/implimentation so i can utilise this other areas - like a
combat list.  I'm still trying to work out some theory, but i am toying
with the concept of having a list of people/mobs in a fight, and weapon
speed, inititive, etc all have a weight/priority, which inserts them into
this priority list accordingly which is called every PULSE_FIGHT_ROUND
(please excuse my lack of circlemud #defines).

   The current room cache is a trial to see if i could expand the concept
to COMBAT and maybe WEATHER or ECONOMY.

   Anyways, i'm hoping my explanation is verbose enough to get some more
feedback.


Thank you kindly folks.

-Pure Krome-

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT