develooper Front page | perl.fwp | Postings from January 2002

Re: Keith's SUAP explanation

Thread Previous | Thread Next
Jason Henry Parker
January 29, 2002 04:27
Re: Keith's SUAP explanation
Message ID:
Stephen Turner <> 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; 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; looked like this:
#!perl -n

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, I tried to read the
whole input into memory and preprocess it before printing it.  Before
I knew it, had a -p0 option, and I was home and hosed.

| The way you tell your story        |
| With no tears for yourself                  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About