Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Perl Golf Ethics

by petdance (Parson)
on Jan 02, 2007 at 17:47 UTC ( #592593=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl Golf Ethics
in thread Perl Golf Ethics

I didn't realize that there was a "perl golf community", or that being part of said community was worth cash.

It leaves a very bad taste in my mouth that this contest was effectively written for a few people who were in the know, who had seen your magic algorithm, shutting out the rest of us.


Comment on Re^2: Perl Golf Ethics
Re^3: Perl Golf Ethics
by Solo (Deacon) on Jan 02, 2007 at 18:44 UTC
    Well, I imagine there are a lot of communities where being part of that community is worth cash.

    There was a cash-paying competition for Perl. Let's agree that more cash for Perl knowledge is a good thing, even if the methods in this case may not meet your standards.

    --Solo

    --
    You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
Re^3: Perl Golf Ethics
by shmem (Canon) on Jan 02, 2007 at 19:32 UTC
      thanks for promoting the book! a small comment, #perlgolf on irc network named IRCNet (not on slashnet, freenode, dalnet, efnet etc).
Re^3: Perl Golf Ethics
by thospel (Hermit) on Jan 02, 2007 at 21:19 UTC
    I agree that this was very unfortunate, but let's not try to read too much into it.

    From an email exchange I know that the organizers didn't know about that particular very relevant historical golf, so it certainly wasn't intentional. I'm quite sure they would not have chosen this challenge if they had known.

    The link to the relevant code was in shmems post in this very thread. You being part of the perlmonks community made that information available to you too.

    As the other solutions in that historical golf show, not hitting on the magic method doesn't loose a good golfer more than (order of magnitude) 5 strokes. This might indeed be enough to pass a few people on the scoreboard, but it's in fact less than the average distance between players.

      I agree that this was very unfortunate, but let's not try to read too much into it.

      I'm not reading anything into it at all. I'm merely saying that it rankles me that I spent over a week on a contest that I thought was a challenge of cleverness and coding skill, not research and being in-the-know.

        it rankles me that I spent over a week on a contest that I thought was a challenge of cleverness and coding skill, not research and being in-the-know
        Sorry Andy, but that's rubbish. With more cleverness and coding skill you could have easily gone 50 strokes lower, as, for example, ambrus did -- he posted a 137 in just one day, with little prior golfing experience and without knowing Ton's magic algorithm.

        I spent 3 all nighters, and then some, coming up with my answer, getting down to 203, and enjoyed the time I spent on it. I wondered (but then gave up) about getting even a t-shirt out of it. Then I saw this thread and eventually found ton's code, and half an answer to the problem. And had some more fun trying to golf down the other half. My daughter even helped in choosing characters to use for variable names ("try a sqiggle there...")...I told her she could have the t-shirt if I won :-)

        Without ton's code, I would have gotten 31st, which would still have been a pretty darn respectable position, and yes, you would have beaten me(28th!), and my hat's off to you for that, but neither of us would have won a prize. I do wonder how many used ton's code (or some other from the same source), and how we all would have done if that were not the case (it's all published, so someone could pretty easily figure it out). I am grateful to PerlMonks though, for the leg up :-) I'm sorry you feel it was a waste of time :-(

        I really wish there could be a contest for good code, based on efficiency, maintainability, etc, but then of course it wouldn't be as easy to score :-)

Re^3: Perl Golf Ethics
by eyepopslikeamosquito (Canon) on Jan 02, 2007 at 22:04 UTC

    Ton's brilliant magic formula won the original roman tournament by only three strokes. It is also worth noting from the fonality golf post mortem that TedYoung (presumably a first time golfer) produced a score of 116.50 before finding Ton's magic formula ... and that a score of 169.51 was enough to win a prize. Also, Jasper, who is part of the Perl golf community, "forgot" about Ton's magic formula, yet was still able to finish in ninth place with a score of 125.

    So not knowing this formula did not "shut out" people from winning a prize. Moreover, searching for perl golf (via google and/or SuperSearch) would have uncovered the original perl golf roman numerals game easily enough (as Ted Young did).

    Perhaps the rules should have been clarified to state, as Ton says, that golfers are expected to research and learn from prior art and that it is not cheating to do so.

    In summary, I do not blame Fonality for this and, despite the prior roman art, the wide range of scores and creative approaches showed that there was a lot of golf played in this competition outside the magic formula.

      Perhaps the rules should have been clarified to state, as Ton says, that golfers are expected to research and learn from prior art and that it is not cheating to do so.

      Indeed. It would have saved me from bothering with the contest at all.

      xoxo,
      Andy

        I'm amused at the downvotes for my saying that I have no interest in a contest based on research. "Darn you, Lester! Expressing an opinion about the type of contest you want to participate in! I'll show you!"

        xoxo,
        Andy

Re^3: Perl Golf Ethics
by eyepopslikeamosquito (Canon) on Jan 03, 2007 at 03:26 UTC

    To do well at Perl golf, perhaps the most important thing is to unearth the "fundamental insights" into the problem. Some of the fundamental insights of this golf were:

    • Rather than calculating a running total, it's shorter and simpler to convert $_ in place; for example, transform II plus III into 2 + 3. With that done, simply use eval to compute the total.
    • The y/IVXLC/XLCDM/ transliteration is a short and sneaky way to multiply by ten.
    • You don't need to write two converters: it is sufficient to write an arabic_to_roman() converter. To convert the other way, simply convert 1..3999 into a table or something and do a lookup. I didn't appreciate this at first and foolishly wrote two converters. When I became aware of my blunderific overlook, my score dropped by 40 strokes.
    • The shortest way to lookup the number corresponding to a roman numeral is to create a symbolic reference for each roman numeral whose value is the corresponding arabic number. For more fun, a la ton and others, transform, for example, II plus III into $II  +$  III and eval that. This is the insight I missed, only trying a hash and a grep lookup.
    • You can further eliminate the array of roman numerals by creating a second set of symbolic references mapping negative numbers to roman numerals. Note that for this to work you must use negative numbers, since positive ones (e.g. $3) are read-only variables used by perl's regex engine. As you might expect, not many of the contestants hit upon this final insight, only ton, Juho, and jojo managing it.
    Notice that none of these insights depends on knowing Ton's magic formula. Golfers like Ton have a knack for finding these insights quickly and easily, while I struggle; once I find them, it is a simple matter of golfing technique to whittle down the solution. For me, the hard part is to find them. Using the above insights, a simple solution like this:
    #!perl -pl map{$_.=(!y/IVXLC/XLCDM/,I,II,III,IV,V,VI,VII,VIII,IX)[$&]while s/\d// +;$$_=$n++}@R=0..3999; y/mp/-+/;s/\w+/${$&}/g;$_=$R[eval]
    comes in at around 130. You could get down to around 120, again without knowing Ton's magic formula, by whittling the arabic-to-roman converter:
    #!perl -pl map{y/IVXLC/XLCDM//s//$&-9?$&-4?I x$&:IV:IX/e&s/I{5}/V/while/\d/;$$_=$ +n++}@R=0..3999; y/m/-/;s/\w+/+${$&}/g;$_=$R[eval]
    To go lower, you'll need to sneak in y/iul-}/-$+ / somewhere to transform $_ directly into symrefs (e.g. $II  +$  III) that can be directly eval'ed. Doing that allows you to eliminate the s/\w+/${$&}/g above. Still further savings are available by replacing the @R array above with a second set of symbolic references, this time mapping negative numbers back to roman numerals.

    While I don't fully understand your shortest 186 solution:

    #!perl -pla %n=I1V5X10L50C100D500M1000=~/(.)(\d+)/g;sub d{$#_-=$z*2*(@_&&$z<$_)-($z=$_)for@n{/./g};@_}$t+=($.=/p/-/n/||$.)*d for@F;map{$s.=$_ x($t/d),$t%=d}M,CM,D,CD,C,XC,L,XL,X,IX,V,IV,I;$_=$s
    it seems like sour grapes to claim that:
    this contest was effectively written for a few people who were in the know, who had seen your magic algorithm, shutting out the rest of us.
    As shown above, without knowing Ton's magic algorithm, you could have easily trimmed 60 strokes off your solution by unearthing the fundamental insights into the problem.

    Update: oops, changed 4e3 to 3999 (4e3 fails test case "MD plus I") plus minor code improvements. Added extra symbolic reference insight.

      Your assessment of my concerns as "sour grapes" and "rubbish" is noted.
        Your assessment of my concerns as "sour grapes" and "rubbish" is noted.

        So what? He, along with others, explained in several different details and in multiple posts why your concerns "seem like sour grapes". (I couldn't find the word "rubbish" at all in the post you're replying to - please take care when you make attributions.) But what should we read in this? That you took offense? And regard it as an ad hominem attack, a' la "you're not my friend anymore"? If so, then I find this grossly irrespectful to us all and non-constructive in a very bad manner, not to say childish. If you have real argumentations, then please expand them. But the more or less general consensus here is that your concerns are not well founded, and people brought good argumentations as to why they are not. So I guess you will have a hard time to confute them. It's certainly easier to dismiss them with your claim that you "thought it was a challenge of cleverness and coding skill, not research and being in-the-know". (As you wrote elsewhere in this thread.) In fact I think your point is void and I'll try to explain why as kindly as possible.

        Basically what you've been claiming, boasting I'd dare to say, in all this thread is that you had been playing under "higher ethical rules", implicitly suggesting that searching for previous golf competitions and solutions would be "unethical": a misunderstood conception of ethicity. Actually, following the same line of reasoning we should never read books or try to learn or exercise or train, but just try to be as clever as possible. Not a wrong thing in and of itself, but cleverness doesn't grow out of nothing. Maybe we should not teach kids ho to do sums, but challenge them and see if they discover by themselves. Maybe we should not teach students e.g. the Theory of Ordinary Differential Equations, but challenge them and see if they discover by themselves.

        Fortunately, we "live on the shoulders of giants": we have a huge heritage from the past. Avoiding to take advantage of that doesn't sound as particularly smart nor "ethical". Granted, some kids who happen to be extremely gifted do rediscover things before they are taught to them. Just as you may rediscover some golfing technique while challenging your coding skills. Of course Perl Golf is only a minor aspect of human culture, but the same rules apply: the truth is that however clever they are, people just have to study and apply. Indeed I bet that even some of the wonderfully skilled golfers who took part to this thread didn't become such out of the blue, but out of study and application. And study and application in this context may mean to do searches and/or "being in-the-know".

        To prevent your next move, I guess you'll make me notice that things are different in this case because we're talking about a competition. To which in turn I answer with another question: so an athlete preparing for a competition should not take advantage of prior art in training for similar competitions?!? That plainly doesn't make sense to me, just as most of your complains and concerns. Matters would be quite different if previous knowledge were not publicly available, in which case to uncover it would require to break some sort of protection. (And would raise the question of ethicity on part of the person holding it, for not sharing it for the advancement of the art and retaining it for exclusive personal advantage, but that's a whole another story.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://592593]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-07-30 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls