[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

1930: Re: [MUD-Dev] Rooms, 3D arrays, etc.

[Full Header] [Plain Text]
From: clawrenc@cup.hp.com
Newsgroups: nu.kanga.list.mud-dev
Date: Fri, 30 May 97 15:56:04 -0700
References: [1]
Organization: Kanga.Nu
In <338C39B2.41C67EA6@iname.com>, on 05/28/97 
   at 09:00 AM, Shawn Halpenny <malachai@iname.com> said:

>I wonder at using some sort of RLE, since if you compressed the
>entire array, wouldn't you have to uncompress the first n elements in
>order to address some element deep into the array?

Nope.  Consider how RLE works.  You can read from teh start of the
conpressed region, extracting the extent of each repetition, summing
them, and thereby locating the exact location a specified element
falls in the compressed string.

eg The RLE string runs:

  Format:
    (flag)(character)(count)     
    0 -- the repetition flag

  (0) (x) (20) (0) (y) (5) (A) (B) (C) (0) (z) (8) (D) (E) (0) (q)
(3)...

Whats the value of array[40]?

Just walk the string summing the repetitions etc, and you'll see its a
'q' -- no literal decompression required.

--
J C Lawrence                           Internet: claw@null.net
(Contractor)                           Internet: coder@ibm.net
---------------(*)               Internet: clawrenc@cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...