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

clawrenc at cup.hp.com clawrenc at cup.hp.com
Fri May 30 15:56:04 CEST 1997


In <338C39B2.41C67EA6 at iname.com>, on 05/28/97 
   at 09:00 AM, Shawn Halpenny <malachai at 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 at null.net
(Contractor)                           Internet: coder at ibm.net
---------------(*)               Internet: clawrenc at cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...




More information about the mud-dev-archive mailing list