[MUD-Dev] FW: A question of message propagation
Joe Kingry
jkingry at uwaterloo.ca
Thu Jun 15 14:04:47 CEST 2000
> Jon A. Lambert wrote:
>
> Not necessarily. There's no need to store whether you visited the room
> if you use a container that eats duplicates. Below is a C++ fragment,
> but it can be done as easily in C as well. queue::get reads the first
> entry off the queue, while queue::put adds to the end of the queue
> only if the item isn't a duplicate.
>
You must be using a queue implementation I don't know about. The eating
duplicate part is not something I have a problem with, it's just well, in
queue's as I understand them queue::get is going to remove and return the
end item off the queue.
If you consider the below map as the case then consider the following:
D--E--F
| | |
C--A--B
| |
G--H
If we start with a message from at A then here is how the queue looks
Add A |Q:A
A Q:Get |Q: Remove and return A
Add B |Q:B Add each of A's exits
Add C |Q:BC
B Q:Get |Q:C Top of loop, queue::get returns B
Add A |Q:CA Add B's exits, note since A is removed it's added again...
Add F |Q:CAF
C Q:Get |Q:AF
Now, if queue simply reads the item and then moves some "end of queue
pointer" to the next item, then it would work as the queue then is holding
everything that has been visited. Though this seems to me as a strange way
to operate as then you have all this extra data that you'll never read again
hanging on the end of the queue.
So, where have I gone wrong?
Joe
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list