Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I've managed to reduce the Hospelian Arabic to Roman Transform by one byte.

As a lead-in, I've read most of your nodes at some point (always good reading, btw), and when I first saw Ton's amazing formula, I spent a few moments dissecting it to figure out how it did what it did. Recently, while working on a similar problem, I decided to see if I could reproduce his formula, armed with the knowledge of how it worked.

A few hours of brute forcing later, and I had a result. Naturally, I wanted to check back here to see how I had done. I was pleasantly surprised to find that I had stumbled upon a formula that was one byte shorter!

Ton's original formula:
y/CLXVI6240-9/MDCLXXVI/dfor$$_.=5x$&*8%29628

The one byte improvement:
y/CLXVI60-9/MDCLXVIX/dfor$$_.="32e$&"%72726

Alternative:
y/CLXVI0-9/MDCLXIXV/dfor$$_.="57e$&"%474976

Even though "32e$&"%72726 is one byte longer than Ton's 5x$&*8%29628, it saves 2 bytes in the transliteration, because 01 is transliterated with IX. The alternative transliterates 012 with IXV, saving yet another byte, but it uses a modulus that's one digit longer.

Update:
Since originally posting, I've found several more alternatives of the same length, using multiple substitutions for I and/or V:

y/CLXVI0-9/MDCLXIVXI/dfor$$_.="49e$&"%87971 y/CLXVI0-9/MDCLXIIXIV/dfor$$_.="7e$&"%10606 # y/CLXVI0-9/MDCLXIIXIV/dfor$$_.="7e$&"%15909 # y/CLXVI0-9/MDCLXIIXIV/dfor$$_.="7e$&"%31818 # These are all essential +ly the same y/CLXVI0-9/MDCLXIIX V/dfor$$_.="8e$&"%61535 # Doesn't contain 3 anywh +ere # although this is one byte longer, it saved a byte in the challenge I + was working on y/CLXVI60-9/MDCLXXI V/dfor$$_.="37e$&"%97366 # Doesn't contain 1 anywh +ere


In reply to Re: Dueling Flamingos: The Story of the Fonality Christmas Golf Challenge by primo
in thread Dueling Flamingos: The Story of the Fonality Christmas Golf Challenge by eyepopslikeamosquito

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (4)
    As of 2014-12-28 22:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (183 votes), past polls