[MUD-Dev] Mail from mud Update :)

Shawn Halpenny malachai at iname.com
Wed Jan 7 10:48:41 CET 1998


On Tue, 6 Jan 1998, JC Lawrence wrote:

> On Sat, 3 Jan 1998 19:18:27 PST8PDT 
> Richard Woolcock<KaVir at dial.pipex.com> wrote:
> > Stephen Zepp wrote:
> >>  Vadim Tkachenko wrote: 
> 
> > I'm catching up on xmas mail, so sorry if someone has mentioned this
> > already...  try a & on the end of the command within system.  
> 
> The problem is still getting the return code from the spawned process.
> 
> > I use
> > a similar thing to delete player-recognition files - system("rm -f
> > -r ../known/*/Kavir &"); or whatever.  I really need to find some
> > effective way to pack info about everyone you know into a single
> > file, yet have a decent way of removing all knowledge of you from
> > everyone elses file when you die...
> 
> I suggest using a variation on reference counting where every data node
> keeps a pointer to what that node refers to, what objects know
> about that data node, and objects keep a list of all that data nodes
> that reference that object.
> 
> From there its just a matter of iterating across the appropriate lists
> and cleaning up.

What about a simple directed graph (rather inelegantly rendered):

            +-----> 1 <-------+
            |      /|\____    |
            |     / |     \   |
            |    V  V      V  |
            +-- 2   3 <--> 4 -+
                ^           |
                |           |
                +-----------+

1 knows 2, 3, and 4.
2 knows 1.
3 knows 4.
4 knows 1, 2, and 3.

Now 4 gets killed:

            +-----> 1
            |      /|
            |     / |
            |    V  V
            +-- 2   3

Any number of graph representation data structures exist along with their
manipulation alogorithms (like JCL, I suggest checking out the Stony
Brook repository  http://www.cs.sunysb.edu/~algorith/ ).

Could be stored in a file.  Could even be stored directly in a file
system (probably inode-expensive).  In any case, there are multiple
implementations.

For grins in sh:

mkdir -p known/1
mkdir known/2
mkdir known/3
mkdir known/4

# 1 knows 2, 3, 4
ln -s ../2 known/1
ln -s ../3 known/1
ln -s ../4 known/1

# 2 knows 1
ln -s ../1 known/2

# 3 knows 4
ln -s ../4 known/3

# 4 knows 1, 2, 3
ln -s ../1 known/4
ln -s ../2 known/4
ln -s ../3 known/4

# kill 4
rm -r known/4

# All dead links refer to dead characters and can be removed as they are
# encountered.
if [ -e known/1/4 ]
then
    echo 1 knows 4.
else
	echo 4 is dead.
fi


Ugly but doable.

--
Shawn




More information about the mud-dev-archive mailing list