In article <[EMAIL PROTECTED]>,
        Andrew Savige <[EMAIL PROTECTED]> writes:
> You might call this "golfing the post mortem" ... speaking of which,
> I bet Ton is still searching for that elusive 98. :-)
>
Nah, I'm not. I'm reasonably confident that the magic formula is
optimal for a one shot number to roman (though I did find a
previously unknown formula that's only one stroke longer) ,
and that the way to use that to solve the problem is also shortest.
(I also realized in the mean time that my range optimizer program
is incomplete, but I don't think it matters for this problem)

The thing I most seriously looked into is that in building the lookup
table i use the magic formula to for number to roman without using the
rest of the table. That seems a waste of a lot of already available
information.

e.g. if you count forward, you can imagine converting number ddddD
by doing:   ($lookup{ddddD} = $lookup{dddd} . magic(D)) =~ y///
where the y/// shifts by one (probably using a for instead of =~ ).

Or maybe not even go through numbers:
  $lookup{$num++} = ripple_carry($accu .= "I")

The s/.//eg loop to convert by digit however is so efficient that I
found nothing to beat it. I'm not very convinced it can't be beaten
though.
--
Help bring about world peace. Kill a fanatic today!

Reply via email to