<?xml version="1.0" encoding="windows-1252"?>
<node id="851128" title="Re^2: The golf course looks great, my swing feels good, I like my chances (Part I)" created="2010-07-24 03:13:36" updated="2010-07-24 03:13:36">
<type id="11">
note</type>
<author id="176576">
eyepopslikeamosquito</author>
<data>
<field name="doctext">
&lt;P&gt;
I just noticed a very similar Roman numeral golf recently concluded at &lt;a href="http://golf.shinh.org/"&gt;golf.shinh.org&lt;/a&gt;.
Adjusting ySas' winning Perl solution to that game for this one produces this 58 stroker:
&lt;CODE&gt;
s/(M)|D/4x@-x5/eg,s/C4//,$\=y/LXVIC4/DCLXM/for(&lt;&gt;)x3;print
&lt;/CODE&gt;
which has a similar form to [robin]'s early-lead 60 stroker above -- though it uses a different algorithm.
Both these solutions are very beautiful, very Perlish, and quite astonishing (at least to me).
&lt;/P&gt;

&lt;P&gt;
I especially enjoyed ySas' ingenious use of &lt;C&gt;@-&lt;/C&gt; above. I've never seen &lt;C&gt;@-&lt;/C&gt; used like that
in golf before and am tempted to give it a name, &lt;I&gt;"ySas' device"&lt;/I&gt;.
By way of explanation, note that adding parentheses around &lt;C&gt;(M)&lt;/C&gt; above adds one
more element to the &lt;C&gt;@-&lt;/C&gt; array when the (parenthesized) &lt;C&gt;M&lt;/C&gt; matches.
That is, the number of items in &lt;C&gt;@-&lt;/C&gt; is used to
differentiate between a matching &lt;C&gt;M&lt;/C&gt; (two items in &lt;C&gt;@-&lt;/C&gt;) and
a matching &lt;C&gt;D&lt;/C&gt; (one item in &lt;C&gt;@-&lt;/C&gt;);
this fits like a glove here because one and two happen to be the required multipliers.
&lt;/P&gt;

&lt;P&gt;
Update: By applying ideas from ySas' solution, we can reduce Robin's
original 60-stroker:
&lt;CODE&gt;
y/DCLXVIM /4 DCLX9/,$\=s/( )?\d/9x($&amp;+!$1)/egfor(&lt;&gt;)x4;print
&lt;/CODE&gt;
to 58:
&lt;CODE&gt;
s/M2//,y/DCLXVIM/1MDCLX2/,$\=s/\d/2x$&amp;x5/egfor(&lt;&gt;)x4;print
&lt;/CODE&gt;
&lt;/P&gt;
</field>
<field name="root_node">
759963</field>
<field name="parent_node">
813652</field>
</data>
</node>
