Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Comment on

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

I'm not antisipating any late entries, so here are provisional findings on the challenge. Final scoring will require me to write up some kind of assessment of the entries and may take a few days, if it gets done at all. (Anyone really interested?)

The program that generates these will be posted below. As will my original attempt (labelled:BrowserUk below). (Update: Corrected score calculations!)

c:\test\685390>685390.plt Testing Anonymonk1-2 Testing Anonymonk1-reworked Testing Anonymonk1 Testing BrowserUk Testing BrowserUk2 Testing BrowserUk3 Testing karavelov Testing kyle Testing kyle2 Testing LimbicRegion2 Testing LimbicRegion3 { Anonymonk1 =>{ ELAPSED=> 1.64, LOC=> 15, OUTCOUNT=> 262, SCORE=> 2 +4.6 }, Anonymonk1-2 =>{ ELAPSED=> 1.48, LOC=> 12, OUTCOUNT=> 262, SCORE=> 1 +7.76 }, Anonymonk1-rw =>{ ELAPSED=> 1.93, LOC=> 27, OUTCOUNT=> 262, SCORE=> 5 +2.11 }, BrowserUk =>{ ELAPSED=>10.57, LOC=> 36, OUTCOUNT=> 262, SCORE=> 38 +0.52 }, BrowserUk2 =>{ ELAPSED=> 2.07, LOC=> 28, OUTCOUNT=> 262, SCORE=> 5 +7.96 }, BrowserUk3 =>{ ELAPSED=> 1.67, LOC=> 49, OUTCOUNT=> 89, SCORE > 8 +1.83 }, LimbicRegion2 =>{ ELAPSED=>11.03, LOC=> 40, OUTCOUNT=> 262, SCORE=> 44 +1.2 }, LimbicRegion3 =>{ ELAPSED=>12.04, LOC=> 63, OUTCOUNT=> 262, SCORE=> 75 +8.52 }, karavelov =>{ ELAPSED=> 5.08, LOC=> 63, OUTCOUNT=> 262, SCORE=> 32 +0.04 }, kyle =>{ ELAPSED=> 4.69, LOC=> 79, OUTCOUNT=> 262, SCORE=> 37 +0.51 }, kyle2 =>{ ELAPSED=> 2.98, LOC=> 73, OUTCOUNT=> 262, SCORE=> 21 +7.54 }, }

(*)manually compacted to comply with the pathetic wrap ilmit. Anybody would think this was the 1970s!

Ignore, BrowserUk2, BrowserUk3 and Anonymonk1-reworked.

  • BrowserUk2 is my attempt to clean up my own entry once I saw the performance of other peoples solutions.

    It must be discounted because it was too influenced by the work of others.

  • BrowserUk3 is my second attempt at clean up avoiding the influence of others.

    A work in progress and currently non-complient.

  • Anonymonk1-reworked is my attempt to sanitize anonymonk's first entry for 'maintanence purposes'.

    This may get posted as part of a further post discussing that subject.

  • The others above are as posted in this thread.

    Kyle is kyle's entry prior to his updates. kyle2 post-updates.

Test program:

My pre-challenge solution, warts an all. It took less than 1 hour to program a recursive solution that found all possible encodings. Another ~2 hours to hack it to fulfill the specs arbitrary limitations:

  1. No adjacent digits.
  2. No digit where a word is available (even if the use of that word does not result in a successful encoding).

I was quite pleased with the LOC & timings, relative to the information available for the Lisp and Java entries.(Until I saw anonymonks entry! :). I was aware it was convoluted and would need refactoring. Hence the attempts above.

#! perl -slw use strict; use List::Util qw[ reduce ]; $a = $b; use constant DICTIONARY => 'dictionary.txt'; my %mappings; reduce{ $mappings{ $_ } = $a for split '', $b; $a + 1; } 0, qw[ e jnq rwx dsy ft am civ bku lop ghz ]; my %dict = map{ $_ => [ $_ ] } 0 .. 9; keys %dict = 300000; open DICT, '<', DICTIONARY or die "${\DICTIONARY}: $!"; while( <DICT> ) { chomp; my $orig = $_; tr[A-Z"/-][a-z]d; #" push @{ $dict{ join '', @mappings{ split '', $_ } } }, $orig; } close DICT; sub encode { my $number = shift; my $start = length( $number ); --$start while $start and not exists $dict{ substr $number, 0, $st +art }; $start = 2 if $start > 1; return @{ $dict{ $number } || [] }, grep !/\d \d/, map { my( $pre, $post ) = unpack "a$_ a*", $number; map{ my $head = $_; map "$head $_", encode( $post ); } @{ $dict{ $pre } || [] }, } $start .. length( $number )-1; } while( <> ) { chomp; my $orig = $_; tr[/-][]d; print "$orig: $_" for encode( $_ ); }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: One for the weekend: (provisional results) by BrowserUk
in thread One for the weekend: challenge by BrowserUk

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (5)
    As of 2018-05-28 01:58 GMT
    Find Nodes?
      Voting Booth?