Program Challenge (was Re: z80 timing... 6502 timing)

From: Fred Cisin <cisin_at_xenosoft.com>
Date: Mon Apr 19 16:08:36 1999

On Sun, 18 Apr 1999, Sean 'Captain Napalm' Conner wrote:
> Problem: Convert a binary value to Roman, using ASCII characters (or
> the native character set if applicable) into a string
> with a termination character (if ASCII, use the NUL (0)
> character).
>
> The valid Roman characters used are:
>
> I 1
> V 5
> X 10
> L 50
> C 100
> D 500
> M 1000
>
> I will assume that all are familiar with how the conversion
> goes 8-) The smallest value allowed is 1, and the largest
> is 3,999. Any value out of this range is to be represented
> as a single character consisting of an asterick (*) or some
> other similar character in whatever character set (if ASCII
> isn't supported) followed by the termination character.
>
> This means that the longest string is 10 characters long:
>
> `M' `M' `M' `C' `M' `X' `C' `I' `X' <termination>

I must be missing something here. 9 does NOT produce the longest string
< 10, 8 does. (IX v VIII), and 3999 isn't the longest string.

3888 would seem to produce:
       M M M D C C C L X X X V I I I \0
which is 16 characters, including null.

BTW, what comes after M? Is it correct that in Roman numerals there can
never be 4 consecutive occurences of the same letter? (The original Y4M
"bug"!!!)

--
Fred Cisin                      cisin_at_xenosoft.com
XenoSoft                        http://www.xenosoft.com
2210 Sixth St.                  (510) 644-9366
Berkeley, CA 94710-2219
Received on Mon Apr 19 1999 - 16:08:36 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:31:44 BST