<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 05 Nov 2010 07:50:03 -0500
From   : jules.richardson99@... (Jules Richardson)
Subject: Programming: Colour names in Sigsumeidsi

Rick Murray wrote:
> This means a single byte can hold two "phrases". How long is the longest 
> phrase likely to be? Eight parts?
> 
> ...
> 
> Anyway, that example is eight parts. Let's be on the safe side and allow 
> "up to 12 parts" if no EOI earlier.
> 
> Each byte can hold two parts, so we would require six bytes.
> 
> There's supposed to be 16 million colours.
> 
> 16,777,216 colours X 6 bytes
> 
> = 100,663,296 bytes.
> 
> = 96 megabytes (exactly).

Well, it compresses a more than that - e.g. "ovra" needs only 8 bits, plus 4 
bits of EOI, so takes up only two bytes (assuming you align on byte 
boundaries, which you wouldn't *have* to do if speed isn't an issue ;-)

*But* you're still allowed to use literal numbers in there, too; this only 
encodes the manipulation operators - not any data upon which they act. I think 
there are a lot more "complex" colours that require literals than there are 
"simple" ones that can be expressed with basic operators, aren't there?

You could compress by choosing the values of data fields such that the most 
common values use a shorter sequence - again, if speed isn't an important factor.

> To be honest, on this alone I'd reject the lookup table.

Heh - well, it wasn't a serious suggestion ;-)

> It's no trouble  at all in going RGB -> Sigwhatsit, as you might even 
 > be able to use the colour value as an indice into the table.
 > However converting back the  other way

Well, I quote: "The programming exercise is to convert between RGB(or HTML 
colors) and the 'simplest' possible Sigsumeidsi color name"

.... there's no customer requirement to convert back the other way ;)

> may well involve walking the 
 > entire lookup table hoping for a
> match. You might say "why not sort it so all "hex" things are together 
> and..... fair point, but this might royally break the RGB indice - you 
> can't have both.

To be honest, I think the list of possible legal names is infinite, is it not? 
You could keep adding and then subtracting data for as long as you wanted and 
have a name that was still legal in the language (so Jonathan was right in 
just storing the shortest name in the lookup table in order to satisfy the 
requirements of the exercise, because there's no way of storing all legal 
names anyway)

> Oh, and my Neuros OSD is a reasonable example of an embedded system, 
> with 32Mb RAM and 16Mb Flash [a fair few routers are much along the same 
> lines]. This 96Mb table will go where? 

It's also got a rather vast amount of read-only storage on tap, in the form of 
whatever DVD device it's connected to ;-)

As for routers, it's probably safe to assume that they're not much use unless 
connected to a network. Define a "Sigsumeidsi colour storage protocol" (SCSP) 
and then all you need to do is point them at a server which contains the 
lookup data and is running a SCSP daemon.

cheers

Jules
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>