Hello Eugene!

[EMAIL PROTECTED] (Eugene Van Der Pijll) wrote:
> Kolakoski:  Rick Klement (54.25)
>             Mtv Europe (56.18)
>             Rick Klement (57.20)
>             Marko Nippula (69.23)
>             Philippe 'BooK' Bruhat (87.21)
>             Jerome Quelin (2255.06)
>
> I'd like to invite the authors of these solutions to explain these
> solutions to the public, or at least the original bits.

Ok, since all others explain their solutions already,
now you'll have to listen my bad English.

As you can see, I start with 66.27 straightforward array manipulations:

push@a,($j=$ARGV[$_&1])x($a[$_]||$j)for@b=0..-1+pop;print@a[@b],$/

Then I play for a while with algorithm that wasn't mentioned
here before and wasn't used by players as far as I know, so
I tell more about it:

-l $.=$_.=$ARGV[$.=~s/(.)\1*/length$&/eg%2-!/^$./]for($_)x pop;print

It's stateless method that uses main property of Kolakovski
sequence in backward fashion - if in infinite sequence you squeeze
repeated digits to its count $.=~s/(.)\1*/length$&/eg, you'll get
back your sequence.    With finite sequence, if after this operation
you get in result beginning of your initial string /^$./, then you'll
need to switch to other generating digit.

Then I start numerous modifications of this algorithm, and found
nice 1&grep variant with about the same functionality and same length 68:

-l $.=$_.=$ARGV[1&grep$.=~s/(.{$_})|.*//&&$1,/./g]for($_)x pop;print

At this moment I decide to throw away regexps (if someone read to this
place, I'll appreciate explanation of "regex or regexp")

Ok, I throw away bigger /regexp?/ and I got 61:

-l for$$(1..pop){$?=0;$_.=$ARGV[1&grep$$>($?+=$_),/./g]}print

Residuary peace of superfluity was obviously addition counter $?,
and then I remember that I can modify loop variable and it will
receive new next value each iteration, so I quickly take 56:

-l for$$(1..pop){$_.=$ARGV[1&grep 0<($$-=$_),/./g]}print

The rest of story is small.   I optimise tiebreaker, but don't submit
it, because it mightn't help me in leaderboard at those moment while
I comfortabily sit with MeowChow of fourth place.  Than I was hit upon
Cantor and than I resubmit Kolakovski to finish this story -
the only difference from previous line is $| instead of 0:

-l for$$(1..pop){$_.=$ARGV[1&grep$|<($$-=$_),/./g]}print

Moreover I used my older experiments with obfuscation (see here
http://www.frox25.dhs.org/~mtve/code/eso/perl/yaoe/  or here
http://www.perlmonks.com/index.pl?node_id=162538 ) to increase
job to referees and to achieve maximum tiebreaker - you can
find it in post-mortem 'Max Tie'.    Of course this is not
maximum possible tie, you can always improve it with addition
^0^0^0^0 etc, but it's very fair balance between min length and
max tie.

Thanks for attention!

Reply via email to