Stephen Turner <[EMAIL PROTECTED]> writes:

> On Mon, 28 Jan 2002, Keith C. Ivey wrote:
> > So for each letter in the word, one number is included in the xor:
> >797 for "a", 7101 for "e", 7105 for "i", 7111 for "o", 7117 for "u",
> >7121 for "y", and 70 for anything else.
> Bravo! I'm not at all surprised no-one else thought of this operation!

I looked at an ASCII chart for a while but inspiration didn't strike;
bit operations aren't my strength.

> > Andrew's choice of this hole was just right.  Challenging enough to
> >keep people away from their work and families until the last moment,
> >and with multiple promising approaches.
> Agreed. The number of completely different solutions is amazing and
> impressive.

One technique for the general golf game that I learned from Mark
Suter, who I taunted mercilessly until he submitted an entry, was to
set up a small sandbox to check in my programs and any updates to
teven.pl; it was *very* helpful to be able to get back that
83-character solution after a series of hopeful modifications had
destroyed it.

The first step, though, was to write simple programs for both holes to
serve as starting points; even.pl looked like this:

even.pl
-------
#!perl -n
($.%2)&&next;
(length)%2||next;
(y/a//%2)&&next;
(y/e//%2)&&next;
(y/i//%2)&&next;
(y/o//%2)&&next;
(y/u//%2)&&next;
(y/y//%2)&&next;
print

140 strokes!  Goodness!  But it did come in a lot of handy; being able
to cut and paste expressions around to try different loops or quoting
meant I could make progress (or decide I'd reached a dead end) very
quickly, hence the revision control.  Even for golf.

I didn't expect that the two holes would provide inspiration for one
another, but eventually, while working on even.pl, I tried to read the
whole input into memory and preprocess it before printing it.  Before
I knew it, gs.pl had a -p0 option, and I was home and hosed.

jason
-- 
||----|---|------------|--|-------|------|-----------|-#---|-|--|------||
| The way you tell your story                 http://linux.org.au/conf/ |
| With no tears for yourself                           [EMAIL PROTECTED] |
||--|--------|--------------|----|-------------|------|---------|-----|-|

Reply via email to