On Sun, 10 Mar 2002 16:05:01 +1100
[EMAIL PROTECTED] wrote:

: It is clear from recent games that Perl Golf is a sport,
: not so different from chess, or real golf for that matter.
: There is strategy there, and tactics too -- with tactics
: predominant, in my opinion.

Thank you very much for sharing these reflections!
 
: 1) Don't get too emotional. Aim for a mental state of relaxed
:    indifference.

Some years ago I played more or less seriously a not-so intellectual
game, but more complex than it may seem in the surface: pool.  What is
complex there is to realize that you are playing against you yourself,
the balls do what _you_ say them to do, and the rival cannot influence
you, he is seated there in a chair, it is just you and the table.  If
you get too emotional you are lost, the calm necessary to think straight
in angles, forces and tactics is gone.

: At this stage, he enjoyed a heady eight stroke advantage over
: his nearest pursuer, Eugene van der Pijll. Now, the s/$&/$&/g
: is elegant and amusing in the extreme. As Rick said:
: 
: 'When I found that s/$&/$&/g, I had the "giggles" for a day'
: 
: Perhaps Rick became so emotionally attached to this construct
: that he subconsciously did not want to improve it.

I felt something special when I realized when I was almost slept last
Thursday night (IIRC) that $& could be moved into the very list when I
was using range operators, so I passed from

    -l $_=pop;chop while print,s/.\B/(0..9,1..9)[$&+chr ord$']/ [61]

to

    -l $_=pop;chop while print,s/.\B/($&..9,1..9)[$'&'?']/eg    [56]

That "movement" liked so much to me that when I sent what was going to
be my final solution, based on hex():

    -l $_=pop;chop while print,s/.\B/hex($&+($'&'?'))%15/eg     [55]

I felt that I was squeezing the solution by one stroke but it plainly
didn't like me that much aesthetically.  Also, I knew that combination
of \B and chop _had_ to be unnecessary, it was verbose, weird, ugly, it
_had_ to be a better way, but I didn't work out how to get rid of it
using fewer keystrokes.

: 3) Be pragmatic. Don't get too carried away with fanciful solutions.

I think this applied specially in the previous tournament, you had to be
pragmatic to use a module and forget fancier approaches unless they gave
a better score.

: Most of the top Perl golfers have such good technique that if you
: throw them an idea, they can quickly refine it into a solution.
: But how do you find the ideas? I welcome any practical advice on
: this

I work by saturation here, I try to detach as much as possible from the
usual way to use functions, operators, etc. trying to be as formal as I
can to try to discover unsight ways of using them.  I think minute by
minute in the problem (I try to get less intensive at work because
otherwise I cannot concentrate enough) and have a thread in my mind that
tries to improve my current solution and some others in parallel looking
for different approaches.  In the meantime I browse the Camel book or,
say, Effective Perl, to study some construct carefully (the _details_ are
often what can bring some advantage) or just looking for inspiration, and
I read O'Reilly's pocket reference many times (the use of hex() occurred
to me that way, I see a single item (say, "redo") and try to fit it in
the problem).  But solutions come to me mainly by saturation at the end.

Well, my 2 cents there.

-- fxn

Reply via email to