Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New Golf

7 views
Skip to first unread message

Ton Hospel

unread,
Dec 25, 2006, 2:31:19 PM12/25/06
to go...@perl.org
http://www.fonality.com/golf/

They are sneakily using it for recruiting (read the rules),
but in compensation it seems to have real prizes.
--
"Sometimes a hacker has a problem, and he thinks to himself
'I know, I'll solve it with a regular expression!'. Now he has two problems."
-- Jamie Zawinski

Jasper

unread,
Jan 2, 2007, 5:13:43 AM1/2/07
to Ton Hospel, go...@perl.org
Congratulations, Ton.

As if the outcome was ever in doubt.. :D

Now, as an afterthought, am I the only person to have missed the
perlgolf history book, and the only person who submitted a score that
didn't have something like : $;.=5x$_*8%29628

:)

I had a good time doing it, though. Thanks, Samy, kept me away from
the nephew and niece for a few days.

Jasper


--
Jasper

Stefan `Sec` Zehl

unread,
Jan 2, 2007, 7:42:31 AM1/2/07
to go...@perl.org

On Tue, Jan 02, 2007 at 10:13 +0000, Jasper wrote:
> Now, as an afterthought, am I the only person to have missed the
> perlgolf history book, and the only person who submitted a score that
> didn't have something like : $;.=5x$_*8%29628

No. Look at \'anick for example (poor \'anick :)

I had once toyed with roman numbers for a local perlgolf, and remembered
that there were already some solutions out there, which I quickly found
via google.

I feel stupid for not realizing that the s/\w+/${$&}/ was optimizable.
But then, I only had half a day to spend on the golf.

Thanks for the game!

CU,
Sec
--
It is easy to be blinded to the essential uselessness of computers by
the sense of accomplishment you get from getting them to run at all.
-- Douglas Adams

Andrew Savige

unread,
Jan 2, 2007, 7:43:08 AM1/2/07
to Jasper, Ton Hospel, go...@perl.org
--- Jasper wrote:
> Congratulations, Ton.

Yep, I echo Jasper's congratulations Ton. What remains freakish is
the speed at which Ton posts a great score.

I'd also like to thank Samy. Having refereed similar sized tournaments
on my own, I know how exhausting and time consuming it is. Thanks Samy!

Here are some names I noticed playing in the fonality tournament and
their final placing from the season ending money list of 2002, as
noted in mtve's perl golf history tome:

-------------------------------------------------
1 Ton Hospel $4,384,000.00 (10/13)
3 (-ugene van der Pijll $3,540,000.00 (10/13)
6 Juho Snellman $1,264,000.00 (6/13)
13 Jasper McCrea $ 719,600.00 (10/13)
17 /-\ndrew Savige $ 652,400.00 (8/13)
23 `/anick Champoux $ 468,800.00 (9/13)
27 Honza Pazdziora $ 420,200.00 (9/13)
35 Michael Wrenn $ 304,506.67 (8/13)
57 Sec $ 179,466.67 (4/13)
-------------------------------------------------

Ah, the good old days. This was my first round of golf for four years
and I enjoyed the little battle at the end for positions 6-9 with my
old golfing buddies pijll, Sec, and Jasper. That little competition
within a competition motivated me to put in some extra last ditch
effort. Sorry 'bout that, Jasper. It never occurred, not in my
wildest dreams that you'd never heard of mtve's big book of golf!
Your name is mentioned in it a total of 97 times.

> Now, as an afterthought, am I the only person to have missed the
> perlgolf history book, and the only person who submitted a score that
> didn't have something like : $;.=5x$_*8%29628

Erm, Yes. You were the only golfer in the top ten who missed it.

And, equally fatal, (-ugene and I seemed to be the only ones who missed
using symbolic references. I sometimes admonish beginners on Perl
Monks, for example:

http://www.perlmonks.org/?node_id=586152

where I said "Symbolic references should be avoided as much as possible",
but forgot to add the caveat "except during golf tournaments".

I look forward to the winner's post mortem analysis. :-)

Cheers,
/-\


Send instant messages to your online friends http://au.messenger.yahoo.com

Jasper

unread,
Jan 2, 2007, 9:26:04 AM1/2/07
to go...@perl.org
On 1/2/07, Andrew Savige <ajsa...@yahoo.com.au> wrote:

> effort. Sorry 'bout that, Jasper. It never occurred, not in my
> wildest dreams that you'd never heard of mtve's big book of golf!

Can someone send me a link? Terje's old link has expired, and there
doesn't seem to be an equivalent on his currently
extant-but-hibernating minigolf site.

Thanks,
Jasper

p.s. Andrew, don't worry, I was cursing you, too!

Daniel Tiefnig

unread,
Jan 2, 2007, 10:10:11 AM1/2/07
to go...@perl.org
Jasper wrote:
> Can someone send me a link? Terje's old link has expired, and there
> doesn't seem to be an equivalent on his currently
> extant-but-hibernating minigolf site.

http://terje2.frox25.no-ip.org/~golf-info/Book.html

It's linked on http://perlgolf.sourceforge.net/ and google finds it if
you search for "perlgolf" only.

lg,
daniel

Eugene van der Pijll

unread,
Jan 2, 2007, 11:34:34 AM1/2/07
to go...@perl.org
En op 18 maart 2002 sprak Andrew Savige:
> Allocating prize money for each of the 5 Perl Golf tournaments
> at $4 million per tournament, according to the formula used by
> the US PGA, produces the following tables.

That figure turns out to have been a bit optimistic...

En op 02 januari 2007 sprak Andrew Savige:


> Here are some names I noticed playing in the fonality tournament and
> their final placing from the season ending money list of 2002, as
> noted in mtve's perl golf history tome:
>
> -------------------------------------------------
> 1 Ton Hospel $4,384,000.00 (10/13)

$4,384,350.00 now...

> It never occurred, not in my
> wildest dreams that you'd never heard of mtve's big book of golf!

I forgot all about it, until it was mentioned on perlmonks. Thanks Ted!

And thanks Ton, for your solution for that previous contest; and thank
you Andrew, for the competition. I won! ;-)

But most of all thank you Samy! It was fun!

Eugene
(now a professional golfer!)

--
Whatever else you say about it, this reduces the code from eleven lines
to six, which is good. -- Mark-Jason Dominus

Yanick Champoux

unread,
Jan 2, 2007, 1:14:41 PM1/2/07
to Stefan `Sec` Zehl, go...@perl.org
Stefan `Sec` Zehl said:
>
> On Tue, Jan 02, 2007 at 10:13 +0000, Jasper wrote:
>> Now, as an afterthought, am I the only person to have missed the
>> perlgolf history book, and the only person who submitted a score that
>> didn't have something like : $;.=5x$_*8%29628
>
> No. Look at \'anick for example (poor \'anick :)

Yeah. Whoever wrote that "the one who doesn't learn from history is
condemned to repeat it" was wildly optimistic. *sigh*

But nevermind that blunderific overlook of the Great Thome of Golfic
Knowledge. Nevermind an obscenely tumefied forehead, caused by repeated
percussions against my desk during the ever-excruciating quest for the
next shaved stroke. What really make me wail like a tax-audited banshee
is that the referee just went through the last of the pending entries,
allowing m.wrenn to sneak one stroke ahead of me and bump me off the
top 20, literally yanking the prized t-shirt off my clenched fists.

m.wrenn, if you are on this list, consider my fist -- yes, that same
fist that you so fiendishly robbed from its prize -- shaked in barely
supressed fury in your general direction. And mark my words: one day, I
shall have my revenge upon thee!

Oh, and many thanks to the referee and Fonality for the course. It
was a blast!

Joy,
`/anick

Philippe Bruhat

unread,
Jan 2, 2007, 10:01:07 PM1/2/07
to go...@perl.org
Le mardi 02 janvier 2007 à 10:13, Jasper écrivait:

> Congratulations, Ton.
>
> As if the outcome was ever in doubt.. :D

In the case where one of the players is actually hired by Fonality,
I wonder if s/he'll be authorized to write the same kind of code in
their production systems as the one they used to get noticed in the
first place...

If so, Fonality will have to run another golf course in order to hire
the maintainer!

--
Philippe "BooK" Bruhat

When you run from your problem, you make it that much harder for good
fortune to catch you, as well. (Moral from Groo The Wanderer #14 (Epic))

Michael Wrenn

unread,
Jan 2, 2007, 10:32:56 PM1/2/07
to Yanick Champoux, go...@perl.org
Yanick Champoux wrote:

> Stefan `Sec` Zehl said:
>
>> No. Look at \'anick for example (poor \'anick :)
>>
>
>
May I be the first to second that!

poor, poor \'anick!

He sets a fine example, doesn't he!


> Yeah. Whoever wrote that "the one who doesn't learn from history is
> condemned to repeat it" was wildly optimistic. *sigh*
>
> But nevermind that blunderific overlook of the Great Thome of Golfic
> Knowledge. Nevermind an obscenely tumefied forehead, caused by repeated
> percussions against my desk during the ever-excruciating quest for the
> next shaved stroke. What really make me wail like a tax-audited banshee
> is that the referee just went through the last of the pending entries,
> allowing m.wrenn to sneak one stroke ahead of me and bump me off the
> top 20, literally yanking the prized t-shirt off my clenched fists.
>
>

First banshee mention of the entire contest! You should win a prize! :-)

OK! Here's what happened to me ... I went out to get some dinner and
returned to check on my solid 20th Place (securing a prized
Fonality/trixbox T-shirt) ... when what to my wondering eyes should
appear, but \'anick the Canuck who was now TWO STROKES CLEAR! I CURSEd
and I SHOUTed and I called him some names| That Bastr/a//d! That
foo|bird! That Flamingo again!!! I'll catch him! I'll pass him! I'll
beat him this time! I'll punk him! I'll twizzle and addle his brain! To
the top of the board! Past Juho and ton! Now slash away, slash away,
slash away all!


When I came to, I was still one stroke back and all my hair had been
yanked out and deposited on the floor next to me. That \'akinc! It was
after 1AM and I needed inspiration. I went into my closet and tried on
all of my T-shirts ... None of them fit! I needed a NEW one!

So, I had another beer (a nice Belgian one) and kept at it and just
before 2AM, I saw the light! An extremely obvious 2 stroker that I had
tried earlier in a slightly different form. I could feel that feeling
of cotton ...


> m.wrenn, if you are on this list, consider my fist -- yes, that same
> fist that you so fiendishly robbed from its prize -- shaked in barely
> supressed fury in your general direction. And mark my words: one day, I
> shall have my revenge upon thee!
>
>

My general direction is South to you! (not to be confused with those
Netherlanderthaliens). I can almost see your fist ... wait ... no ...
that's the Statue of Liberty ... my bad!

I am pleased to know you are after me! No one ever cared about me as
much as you! I am touched by your kind words and your touching
sentiment! But, please don't get too close.


> Oh, and many thanks to the referee and Fonality for the course. It
> was a blast!
>
> Joy,
> `/anick
>
>

Oh \'anick! Forever Joyful \'anick!

Thanks to Fonality and, of course, Samy Kamkar, for the course!

I was up at 3AM to see the board change to the Post-Mortem with my
T-shirt hanging in the balance. I was at work at 11:30 before I
"officially" won, when the front page results changed me from 21 to 20.

poor \'anick!

All the best in 2007!

Michael

Samy Kamkar

unread,
Jan 2, 2007, 11:10:48 PM1/2/07
to go...@perl.org, Michael Wrenn, Yanick Champoux
Michael, what an amazing story. I laughed, I cried, I moved you back
down to 21. Just kidding!

Thank you all for playing! It was an awesome golf! Hope to join in on
the next public golf.

ps, winners will be contacted shortly (or already have been) to receive
their prizes!

Andrew Savige

unread,
Jan 3, 2007, 5:42:12 AM1/3/07
to Michael Wrenn, Yanick Champoux, go...@perl.org
--- Michael Wrenn wrote:
> OK! Here's what happened to me ... I went out to get some dinner and
> returned to check on my solid 20th Place (securing a prized
> Fonality/trixbox T-shirt) ... when what to my wondering eyes should
> appear, but \'anick the Canuck who was now TWO STROKES CLEAR! I CURSEd
> and I SHOUTed and I called him some names| That Bastr/a//d! That
> foo|bird! That Flamingo again!!! I'll catch him! I'll pass him! I'll
> beat him this time! I'll punk him! I'll twizzle and addle his brain! To
> the top of the board! Past Juho and ton! Now slash away, slash away,
> slash away all!
>
> When I came to, I was still one stroke back and all my hair had been
> yanked out and deposited on the floor next to me. That \'akinc! It was
> after 1AM and I needed inspiration. I went into my closet and tried on
> all of my T-shirts ... None of them fit! I needed a NEW one!
>
> So, I had another beer (a nice Belgian one) and kept at it and just
> before 2AM, I saw the light! An extremely obvious 2 stroker that I had
> tried earlier in a slightly different form. I could feel that feeling
> of cotton ...

Yes, doing battle with `/anick is perhaps the pinnacle of any golfer's
career. Michael, thanks for sharing that story; it was great compensation
for not having the pleasure of battling with `/anick hand-to-hand this
time around.

BTW, I've jotted down a few scrappy and informal "fundamental insights"
into this golf game at:

http://www.perlmonks.org/?node_id=592689

Please let me know of other "fundamental insights" I've missed or any
"blunderific overlooks" that I've made. I'm not sure I like the term
"fundamental insight" and I'm open to persuasion as to a better term.
[Erm, I'm a bit ashamed to admit that I was provoked into writing these
notes in response to what I perceived (perhaps incorrectly) to be an
attack on perl golfers ... which I won't stand for ;-)].

Yanick Champoux

unread,
Jan 4, 2007, 12:01:23 AM1/4/07
to Andrew Savige, Michael Wrenn, go...@perl.org
On Wednesday 03 January 2007 05:42, Andrew Savige wrote:
> Yes, doing battle with `/anick is perhaps the pinnacle of any golfer's
> career.

Flattering, but I have to disagree. It's akin to say that the most
breath-taking act at the circus is the clown intermission. But still, I like
to think that a clash with yours sequin-clad truly is, if not the most epic
moment of a golf competition, at least the one with the most retellable
value. :-)

> Michael, thanks for sharing that story; it was great compensation
> for not having the pleasure of battling with `/anick hand-to-hand this
> time around.

Hopefully, next time we'll be able to once more cross blades. And maybe, just
maybe, for once I'll be able to get the upper hand. (what? hope /does/ spring
eternal)

> I'm not sure I like the term
> "fundamental insight" and I'm open to persuasion as to a better term.

I know I'm bending a lot the meaning of the word, but I like to think of your
fundamental insights as golf koans.

Joy,
`/anick

Yanick Champoux

unread,
Jan 4, 2007, 12:22:53 AM1/4/07
to Michael Wrenn, go...@perl.org
On Tuesday 02 January 2007 22:32, Michael Wrenn wrote:
> Yanick Champoux wrote:
> > Stefan `Sec` Zehl said:
> >> No. Look at \'anick for example (poor \'anick :)
>
> May I be the first to second that!
>
> poor, poor \'anick!

Now, now, now. Isn't there some tacit rule in the gentlemen's code of honor
about winning and being gracious about it?

On the other hand, I can see that there is little point in winning if you
can't point and snicker at the loser.

> First banshee mention of the entire contest! You should win a prize! :-)

Yeah, I should. And I would've if it wasn't for a certain someone... And no,
don't look around like that. I'm talking about /you/.

> OK! Here's what happened to me ... [..]

Well, I must say that I felt pretty blue about losing that 20th position. But
learning that in order to snatch it away from me you had to sacrifice the
peaceful digestion of a festive dinner, a Belgian beer, the best part of your
night and all of your cranial capilarity makes me feel much, much better.
(hmm. I should find a way to phrase that such that make me sound a tad less
moraly bankrupt)


> I am pleased to know you are after me! No one ever cared about me as
> much as you! I am touched by your kind words and your touching
> sentiment!

aaah... err... well, you're welcome. But you do realize I was declaring war,
vowing terrible retribution and all that stuff, right?


> But, please don't get too close.

Not a big proponent of "keep your friends close, and your enemies closer",
then? :-)


Joy,
`/anick

Robin Houston

unread,
Jan 4, 2007, 9:01:08 AM1/4/07
to go...@perl.org, perl...@moderators.isc.org
On the subject of new golf, I wonder if you golfers all know about
http://codegolf.com?

The rules are not quite the same as traditional Perl golf: the most
important difference is that the whole of the shebang line counts
towards the size, which effectively penalises the use of switches by
seven strokes ("#!perl" + the newline) and makes the }{ business less
useful.

The other significant differences are that programs have to terminate
within 4 seconds of wall-clock time on the server, and that modules -
even core modules - can't be used. But it's just as fun to play IMO.

You have to compete against Ruby programmers in the overall ranking,
but there are separate rankings by language. (Or perhaps it's an excuse
to learn Ruby, for the really serious competitor: some problems seem to
be more golfable in Ruby than Perl, and some are the other way around.)
Entries are also allowed in Python and PHP, but those aren't good
golfing languages and offer no real competition.

There are a few familiar perlgolf names on the leaderboards, but most
of you seem to be absent.

Robin

Andrew Savige

unread,
Jan 4, 2007, 6:44:04 PM1/4/07
to Stefan `Sec` Zehl, go...@perl.org
It seems to me that some of the solutions are not quite correct, failing the
test case:

MD plus I

which should produce the answer MDI.

Please correct me if I'm wrong, but it seems that the shortest solutions
of szery, Sec and Jasper all fail this test case.

Falling back one stroke from 4e3 to 3999 remedies.

Please let me know if I've made a blunderific oversight.

Thanks,

Jasper

unread,
Jan 4, 2007, 7:20:44 PM1/4/07
to Andrew Savige, Stefan `Sec` Zehl, go...@perl.org
On 1/4/07, Andrew Savige <ajsa...@yahoo.com.au> wrote:
> It seems to me that some of the solutions are not quite correct, failing the
> test case:
>
> MD plus I
>
> which should produce the answer MDI.
>
> Please correct me if I'm wrong, but it seems that the shortest solutions
> of szery, Sec and Jasper all fail this test case.
>
> Falling back one stroke from 4e3 to 3999 remedies.
>
> Please let me know if I've made a blunderific oversight.

I've no doubt you're correct. 4e3 (vs 3999) seemed to bork for me
sometimes, but passed the test suite for my final solution.

I don't really mind, since it doesn't change my final position (nor Sec's)

Jasper

Stefan `Sec` Zehl

unread,
Jan 4, 2007, 7:50:24 PM1/4/07
to go...@perl.org
Oh,

On Fri, Jan 05, 2007 at 10:44 +1100, Andrew Savige wrote:
> It seems to me that some of the solutions are not quite correct, failing the
> test case:
>
> MD plus I

Well. Thats definitely bad. I gather that is what I get for taking other
peoples ideas from the web :-)

Ok, count me as

romancalc.pl: 120.51 strokes (ok), md5=82eb4544217b1d7054bb90e9c75e3d27

then %)

CU,
Sec
--
Programs that make a computer worth to use:
FreeBSD, zsh, mutt, wmx, procmail, vim, perl, less, LaTeX, fetch, slrn,
screen, ssh, pgp, ircII, sendfile

Andrew Savige

unread,
Jan 4, 2007, 11:43:00 PM1/4/07
to Stefan `Sec` Zehl, go...@perl.org
--- Stefan `Sec` Zehl (principal taunter of `/anick) wrote:
> Ok, count me as
>
> romancalc.pl: 120.51 strokes (ok), md5=82eb4544217b1d7054bb90e9c75e3d27

Woohoo! Just two more diabolical test cases and I'll have caught the
elusive Sec. ;-)

You might call this "golfing the post mortem" ... speaking of which,
I bet Ton is still searching for that elusive 98. :-)

Cheers,

Andrew Savige

unread,
Jan 5, 2007, 6:39:47 AM1/5/07
to Andrew Savige, Stefan `Sec` Zehl, go...@perl.org
--- /-\ndrew Savige wrote:
> It seems to me that some of the solutions are not quite correct, failing the
> test case:
>
> MD plus I
>
> which should produce the answer MDI.
>
> Please correct me if I'm wrong, but it seems that the shortest solutions
> of szery, Sec and Jasper all fail this test case.
>
> Falling back one stroke from 4e3 to 3999 remedies.

Found another. Ted Young's 107 fails this test case:

MD minus I

which should emit:

MCDXCIX

but Ted's entry emits:

MMMCMXCIX

At least that's what I see.

As per szeryf, Sec and Jasper, changing 4e3 to 3999 remedies,
at the cost of a stroke.

Cheers,

Ton Hospel

unread,
Jan 7, 2007, 7:41:36 AM1/7/07
to go...@perl.org
In article <1167919268....@i15g2000cwa.googlegroups.com>,

"Robin Houston" <robin....@gmail.com> writes:
> On the subject of new golf, I wonder if you golfers all know about
> http://codegolf.com?
>
> The rules are not quite the same as traditional Perl golf: the most
> important difference is that the whole of the shebang line counts
> towards the size, which effectively penalises the use of switches by
> seven strokes ("#!perl" + the newline) and makes the }{ business less
> useful.
>

That's the major issue stopping me. A
7 stroke penalty to use options is just too much.

> The other significant differences are that programs have to terminate
> within 4 seconds of wall-clock time on the server, and that modules -
> even core modules - can't be used. But it's just as fun to play IMO.
>

And I'm not too wild about this one either. Usually it's not much of a
problem, but for things like "calculate pi to 1000 places" in a languages
without builtin bignums, it's just too painfull

And of course I'm trying not to waste too much time on golf...

Ton Hospel

unread,
Jan 7, 2007, 7:56:14 AM1/7/07
to go...@perl.org
In article <2007010504430...@web56410.mail.re3.yahoo.com>,

Andrew Savige <ajsa...@yahoo.com.au> writes:
> You might call this "golfing the post mortem" ... speaking of which,
> I bet Ton is still searching for that elusive 98. :-)
>
Nah, I'm not. I'm reasonably confident that the magic formula is
optimal for a one shot number to roman (though I did find a
previously unknown formula that's only one stroke longer) ,
and that the way to use that to solve the problem is also shortest.
(I also realized in the mean time that my range optimizer program
is incomplete, but I don't think it matters for this problem)

The thing I most seriously looked into is that in building the lookup
table i use the magic formula to for number to roman without using the
rest of the table. That seems a waste of a lot of already available
information.

e.g. if you count forward, you can imagine converting number ddddD
by doing: ($lookup{ddddD} = $lookup{dddd} . magic(D)) =~ y///
where the y/// shifts by one (probably using a for instead of =~ ).

Or maybe not even go through numbers:
$lookup{$num++} = ripple_carry($accu .= "I")

The s/.//eg loop to convert by digit however is so efficient that I
found nothing to beat it. I'm not very convinced it can't be beaten
though.
--
Help bring about world peace. Kill a fanatic today!

Andrew Savige

unread,
Jan 11, 2007, 10:53:16 PM1/11/07
to Ton Hospel, go...@perl.org
I've done a post mortem report on the Fonality tournament at:

http://www.perlmonks.org/?node_id=594299

Unfortunately, I had to remove the lovely little orange picture
of (-ugene because I seem to have hit the size limit of a Perl
Monks meditation. :-(

The little pink picture of `/anick remains, however. :-)

Please let me know if you see something in the report that
makes you pull a face.

Thanks,

Ton Hospel

unread,
Jan 12, 2007, 8:56:59 AM1/12/07
to go...@perl.org
In article <84052.6...@web56401.mail.re3.yahoo.com>,

Andrew Savige <ajsa...@yahoo.com.au> writes:
> Please let me know if you see something in the report that
> makes you pull a face.
>

I think you should also explain how constructing the table
backwards (from 3999 to 1) allows you to put the $$$_=$_
*inside* the s///eg, since that way the wrong entries for
the partial roman strings during buildup get fixed later on.
And maybe also why the range can be safely extended to
4000..0

Readers of your perlmonks article probably also don't
understand the inside joke about amounts of money won.
(I wish they were real :-) )

I'd also like to point out that my entry is as far as
I know the first use of a functional smiley (-: in
golf code.

--
As a lawyer working for Bohr & Associates, we recently discovered the sum
of 8*10^16 Joules ((80000000000000000 Joules) held inside 1kg of Uranium
235. If with your help, we can free this energy, through a fission
reaction, you will receive 0.1% of it in the form of heat, which can be
used to drive turbines.

Wishing you long life,
Asumemwe Obugo, Lawyer, Nigeria

Andrew Savige

unread,
Jan 12, 2007, 4:08:16 PM1/12/07
to Ton Hospel, go...@perl.org
--- Ton Hospel wrote:
> I think you should also explain how constructing the table
> backwards (from 3999 to 1) allows you to put the $$$_=$_
> *inside* the s///eg, since that way the wrong entries for
> the partial roman strings during buildup get fixed later on.
> And maybe also why the range can be safely extended to
> 4000..0

I've added a new "Tactical Tricks" section which mentions
both these excellent insights.



> Readers of your perlmonks article probably also don't
> understand the inside joke about amounts of money won.
> (I wish they were real :-) )

That was deliberate. Being a stirrer, I was hoping that not
explaining it might provoke a question from the gallery as to
what all that money means and is it really real. Let's wait
and see if anyone takes the bait. Whoa, I hope petdance
doesn't, I don't think I've got the energy for another
mega-thread. :-)

> I'd also like to point out that my entry is as far as
> I know the first use of a functional smiley (-: in
> golf code.

This has now been noted in the "Top Ten Countdown" section
which I also expanded a bit, giving more kudos to Juho for
gamely leading the pursuing pack and to TedYoung for the
big improvements he has made to his golf game during his
four year hiatus.

Andrew Savige

unread,
Jan 13, 2007, 9:20:16 PM1/13/07
to Michael Wrenn, Yanick Champoux, go...@perl.org
--- Michael Wrenn wrote:
> ... An extremely obvious 2 stroker ...

I've cast my eye over your and `/anick's solutions looking for
any more "obvious 2 strokers". Alas, I couldn't find one in
`/anick's masterwork, but I did find another Mr Magoo-esque
2 stroker in your 169.51, namely changing:

qw(IV XL CD V L D IX XC CM X C M)

to:

(IV,XL,CD,V,L,D,IX,XC,CM,X,C,M)

Can anyone else see anything Mr Magoo-like in m.wrenn's or
`/anick's solutions? Just to rub it in, you see. :-)

For your convenience, here is `/anick's 170.51:

#!perl -lp040
$s=/m/
if/u/;($y=I1V5X10L50C100D500M1000IV4IX9XL40XC90CD400CM900)=~/$&/,$i=$t+=$s^"$;">($;=$')?-$;:$;while
s/.$//}{1while$y=~/(\D+)$i/&&$t>=$i?($_.=$1,$t-=$i):$i--

and here is m.wrenn's 169.51:

#!perl -lp
@@{@@=map{$_,$_.0,$_*100}4,5,9,10}=qw(IV XL CD V L D IX XC CM X C
M);for$~(@@){s/$@{$~}/"I "x$~/ge}s/I//while s/m\w* +I/m
/;$~=y/I//cd;s/I{$~}/$@{$~}||$&/gewhile$~--

I also made the mistake of idly golfing on Util's 129.50:

#!perl -lp
$==$_,s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$_[$=].=4x$&%1859^7;5!egfor+0..3999;@&{@_}=0..@_;y/il-z/-+/d;s/\w+/$&{$&}/g;$_=$_[eval]

and was horrified to transform it into a 117 [*one* less than (-ugene!!]:

#!perl -lp
s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$X[$_].=4x$&%1859^7!egfor+0..3999;@Y{@X}=0..@X;y/m/-/;s/\w+/+$Y{$&}/g;$_=$X[eval]

in only a few minutes. I had toyed with Util's approach during
the game, but kept floggin' the same old dead horse. :-(
For some reason, I find it difficult psychologically to let go
of one approach and switch to a new one.

Can Util's approach be taken below 117? I wonder what is the lowest
score possible without using symbolic references.

Oh, and does anyone know who "jojo" is and what country he/she
comes from? (Someone by that name has played 12 challenges at
codegolf.com).

Andrew Savige

unread,
Jan 14, 2007, 5:04:39 AM1/14/07
to Ton Hospel, go...@perl.org
On Thu, 2 May 2002, Stephen Turner wrote:
> On Thu, 2 May 2002, Ton Hospel wrote:
>>
>> Jerome Quelin writes:
>>>
>>> I begin to think that Ton is an alien. This makes me wonder: has anyone
>>> seen Ton in real life? ;)
>>>
>> I have.
>
> That's just what an alien _would_ say.
>
> --
> Stephen Turner, Cambridge, UK http://homepage.ntlworld.com/adelie/stephen/
> "This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01

I feel Ton's magical arabic to roman converter warrants being honoured
with a name -- and maybe a wikipedia entry. :-).

My first thought was HART: Hospelian Arabic to Roman Transform.

Remembering this old "ton is an alien" thread, I now propose "Earthman":

Eye-popping Alien Roman Ton Hospelian Magical Algorithm for Numerals

If you can think of a better name, please let us know. :-)

Cheers,

Ton Hospel

unread,
Jan 14, 2007, 9:59:52 AM1/14/07
to go...@perl.org
In article <26894.3...@web56415.mail.re3.yahoo.com>,

Andrew Savige <ajsa...@yahoo.com.au> writes:
> --- Michael Wrenn wrote:
>> ... An extremely obvious 2 stroker ...
>
> I've cast my eye over your and `/anick's solutions looking for
> any more "obvious 2 strokers". Alas, I couldn't find one in
> `/anick's masterwork, but I did find another Mr Magoo-esque
> 2 stroker in your 169.51, namely changing:
>
> qw(IV XL CD V L D IX XC CM X C M)
>
> to:
>
> (IV,XL,CD,V,L,D,IX,XC,CM,X,C,M)
> #!perl -lp
> s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$X[$_].=4x$&%1859^7!egfor+0..3999;@Y{@X}=0..@X;y/m/-/;s/\w+/+$Y{$&}/g;$_=$X[eval]
>
> in only a few minutes. I had toyed with Util's approach during
> the game, but kept floggin' the same old dead horse. :-(
> For some reason, I find it difficult psychologically to let go
> of one approach and switch to a new one.
>
> Can Util's approach be taken below 117? I wonder what is the lowest
> score possible without using symbolic references.
>
The most obvious target is to get rid of the 0:
#!perl -pl
s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$X[$_].=4x$&%1859^7!egfor!y/m/-/..3999;@Y{@X}=0..@X;s/\w+/+$Y{$&}/g;$_=$X[eval]

(115.54)

Ton Hospel

unread,
Jan 14, 2007, 10:25:10 AM1/14/07
to go...@perl.org
In article <eodgh8$3rj$1...@post.home.lunix>,

perl...@ton.iguana.be (Ton Hospel) writes:
> The most obvious target is to get rid of the 0:
> #!perl -pl
> s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$X[$_].=4x$&%1859^7!egfor!y/m/-/..3999;@Y{@X}=0..@X;s/\w+/+$Y{$&}/g;$_=$X[eval]
>
> (115.54)

Also use map to get the range:

#!perl -pl
@Y{@X}=0..map s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$X[$_].=4x$&%1859^7!eg,!y/m/-/..3999;s/\w+/+$Y{$&}/g;$_=$X[eval]

(114.54)

Ton Hospel

unread,
Jan 14, 2007, 10:31:00 AM1/14/07
to go...@perl.org
In article <eodi0m$57p$1...@quasar.home.lunix>,

t...@quasar.home.lunix (Ton Hospel) writes:
> #!perl -pl
> @Y{@X}=0..map s!.!y$IVCXL91-I0$XLMCDXVIII$dfor$X[$_].=4x$&%1859^7!eg,!y/m/-/..3999;s/\w+/+$Y{$&}/g;$_=$X[eval]
>
> (114.54)

Exactly the same thing, but taking a bit more care with the tie breaker
so that it actually beats szeryf's solution:

#!perl -pl
@%{@;}=0..map+s!.!y$IVCXL426(-:$XLMCDIVX$dfor$;[$_].=5x$&*8%29628!eg,!y/m/-/..3999;s/\w+/+$%{$&}/g;$_=$;[eval]

(114.47)

Yanick Champoux

unread,
Jan 14, 2007, 11:15:42 AM1/14/07
to go...@perl.org, Andrew Savige
On Saturday 13 January 2007 21:20, Andrew Savige wrote:
> Can anyone else see anything Mr Magoo-like in m.wrenn's or
> `/anick's solutions? Just to rub it in, you see. :-)

You, my friend, are a very evil, very cruel man.

> I had toyed with Util's approach during
> the game, but kept floggin' the same old dead horse. :-(
> For some reason, I find it difficult psychologically to let go
> of one approach and switch to a new one.

I think that being able to Let Go, not to mention knowing when to let go, are
yet another of those skills that separate the true golfmeisters from mere
mortals. Personally, I know that early in the game I try a few different
approaches to get a grip of the challenge (I first come out with a naive but
working solution, then start again from scratch with a more golfing frame of
mind). Then, as the game progress, the changes to the solution become less
revolutionary, and more evolutionary. With the exceptions of when one of
those evolution steps naturally leads to a revolutionary leap (like the
prehistoric bat realizing that it doesn't have to climb down trees anymore
but can go flap-flap-flap instead, so a golfer realizes he really doesn't
really need that hash anymore).


Joy,
`/anick

Ton Hospel

unread,
Jan 14, 2007, 11:12:17 AM1/14/07
to go...@perl.org
In article <26894.3...@web56415.mail.re3.yahoo.com>,
Andrew Savige <ajsa...@yahoo.com.au> writes:
> Can anyone else see anything Mr Magoo-like in m.wrenn's or
> `/anick's solutions? Just to rub it in, you see. :-)
>
Super trivial Magoo on yanicks solution, good for one T-shirt:

=~/$&/ can be written as =~$&

Ton Hospel

unread,
Jan 14, 2007, 11:31:22 AM1/14/07
to go...@perl.org
In article <eodkp1$7mt$1...@post.home.lunix>,

Less Magoo:

#!perl -lp040
$s=/m/
if/u/;($y=I1V5X10L50C100D500M1000IV4IX9XL40XC90CD400CM900)=~chop,$t+=$s^"$;">($;=$')?-$;:$;while$_}{1while$y=~/(\D+)$?/&&$t>=$??($_.=$1,$t-=$?):--$?

(162.52)

Yanick Champoux

unread,
Jan 15, 2007, 10:55:51 PM1/15/07
to go...@perl.org, Ton Hospel
On Sunday 14 January 2007 11:31, Ton Hospel wrote:
> > Super trivial Magoo on yanicks solution, good for one T-shirt:
> >
> > =~/$&/ can be written as =~$&
>
> Less Magoo:
>
> #!perl -lp040
> $s=/m/
> if/u/;($y=I1V5X10L50C100D500M1000IV4IX9XL40XC90CD400CM900)=~chop,$t+=$s^"$;
>">($;=$')?-$;:$;while$_}{1while$y=~/(\D+)$?/&&$t>=$??($_.=$1,$t-=$?):--$?
>
> (162.52)

Do'h! I clean forgot about the validity of =~$foo, and not having realized
that I could acheive big numberness by moonwalking through the backdoor is
just silly, silly, silly. I stand humbled, ô Great Ton.


Listening, learning,
`/anick

Phil Carmody

unread,
Jan 16, 2007, 9:19:38 AM1/16/07
to go...@perl.org
This is a real world task which can be solved in a couple of lines.
Which makes me think that you guys can do it in about half a line!

The simple version of the task is to verify that each line of a file is the
insertion of one character somewhere (maybe at the start or the end) into the
prior line.

So
<<<
1
12
132
x132
>>>
would be accepted, but
<<<
1
12
132
alien132
>>>
would not be accepted.

If that's too easy, or too short, the more advanced version of the task is for
each line to print which character has been inserted in which position for each
line.

There's a lot of flexibility on how the verification result is reported to the
user, so you may, within sensible limits, do whatever's best. An error return
value, or printing a Y or N, or 1 or 0, or the line number on which it fails,
or anything like that would be fine. Similarly, whether you start counting at 0
or 1, I don't care, I can cope with both.

This is for a little bit of mathematical research I'm doing (so the lines in
the file will actually just be big numbers), and I will happily credit the
winner when I announce the results of the research. That'll be weeks away, but
I wouldn't want anyone to waste more than a short while on this task.

Phil

() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



____________________________________________________________________________________
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail

Andy Bach

unread,
Jan 16, 2007, 11:17:35 AM1/16/07
to go...@perl.org
> My first thought was HART: Hospelian Arabic to Roman Transform.

>Remembering this old "ton is an alien" thread, I now propose "Earthman":

Eye-popping Alien Roman Ton Hospelian Magical Algorithm for Numerals

> If you can think of a better name, please let us know. :-)

I don't know of any value of 'better' that would top that one ... I do
know why I can't play golf - even your acronymn are beyond me ;->

a

Andy Bach
Systems Mangler
Internet: andy...@wiwb.uscourts.gov
VOICE: (608) 261-5738 FAX 264-5932

If it's not on fire it's a software problem.

Yanick Champoux

unread,
Jan 16, 2007, 12:42:02 PM1/16/07
to Phil Carmody, go...@perl.org

Yanick Champoux

unread,
Jan 16, 2007, 12:44:02 PM1/16/07
to Phil Carmody, go...@perl.org
Phil Carmody said:
> This is a real world task which can be solved in a couple of lines.
> Which makes me think that you guys can do it in about half a line!

Not exactly half a line, but still not too bad:

#!perl -lp
$p=~s/\B|\b/(.)?/g;/^$p$/;
$p=$_;$_=(@m=grep/./,@-)==2?pop@m:die"broken sequence";


Joy,
`/anick

Ton Hospel

unread,
Jan 16, 2007, 1:47:11 PM1/16/07
to go...@perl.org
In article <44740.4...@web25409.mail.ukl.yahoo.com>,

Phil Carmody <thefa...@yahoo.co.uk> writes:
> This is a real world task which can be solved in a couple of lines.
> Which makes me think that you guys can do it in about half a line!
>
> The simple version of the task is to verify that each line of a file is the
> insertion of one character somewhere (maybe at the start or the end) into the
> prior line.
>
> So
> <<<
> 1
> 12
> 132
> x132
>>>>
> would be accepted, but
> <<<
> 1
> 12
> 132
> alien132
>>>>
> would not be accepted.

Regex is always nice:
-p0 $_ x=/^((.*)(.*)
(?=\2.\3
|$))*$/

Phil Carmody

unread,
Jan 16, 2007, 2:00:03 PM1/16/07
to go...@perl.org
In response to Phil Carmody <thefa...@yahoo.co.uk> saying:

> > The simple version of the task is to verify that each line of a file is the
> > insertion of one character somewhere (maybe at the start or the end) into
> > the prior line.

--- Ton Hospel <perl...@ton.iguana.be> wrote:
<<<

-p0 $_ x=/^((.*)(.*)
(?=\2.\3
|$))*$/

>>>

Nice indeed. But would this count as a -4 Magoo?

-p0 s/^((.*)(.*)
(?=\2.\3
|$))*$//


Phil

() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

Ton Hospel

unread,
Jan 16, 2007, 3:16:06 PM1/16/07
to go...@perl.org
In article <173192....@web25404.mail.ukl.yahoo.com>,

Phil Carmody <thefa...@yahoo.co.uk> writes:
> In response to Phil Carmody <thefa...@yahoo.co.uk> saying:
>> > The simple version of the task is to verify that each line of a file is the
>> > insertion of one character somewhere (maybe at the start or the end) into
>> > the prior line.
>
> --- Ton Hospel <perl...@ton.iguana.be> wrote:
> <<<
>
> -p0 $_ x=/^((.*)(.*)
> (?=\2.\3
>|$))*$/
>
>>>>
>
> Nice indeed. But would this count as a -4 Magoo?
>
> -p0 s/^((.*)(.*)
> (?=\2.\3
>|$))*$//
>
Absolutely

Juho Snellman

unread,
Jan 16, 2007, 3:51:42 PM1/16/07
to Phil Carmody, go...@perl.org
Phil Carmody <thefa...@yahoo.co.uk> writes:
> -p0 s/^((.*)(.*)
> (?=\2.\3
> |$))*$//

Assuming the last line is also newline-terminated:

-n0 a//^((.*)(.*
)(?=\2.\3|$))*$/

--
Juho Snellman

Phil Carmody

unread,
Jan 16, 2007, 7:59:51 PM1/16/07
to go...@perl.org
--- Juho Snellman <jsn...@iki.fi> wrote:
> Phil Carmody <thefa...@yahoo.co.uk> writes:
> > -p0 s/^((.*)(.*)
> > (?=\2.\3
> > |$))*$//
>
> Assuming the last line is also newline-terminated:

Fair assumption

> -n0 a//^((.*)(.*
> )(?=\2.\3|$))*$/

Kiitos, Juho.

That's gone beyond my perl ken! Was this the expected failure outcome?

$ echo -e "1\n12\n173\n" | perl -n0 -e 'a//^((.*)(.*
)(?=\2.\3|$))*$/'
Illegal division by zero at -e line 1, <> chunk 1.

Unfortunately it looks like it fails to even finish my 2400-line file - what's
its Big-Oh? :

$ time perl -n0 -e 'a//^((.*)(.*
)(?=\2.\3|$))*$/' < delsieve.log

<fx: kuolemanhiljaisuus />

Thanks for the interesting, and horribly short, contribution though.
Phil

() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

Ronald J Kimball

unread,
Jan 16, 2007, 10:08:59 PM1/16/07
to Phil Carmody, go...@perl.org
On Tue, Jan 16, 2007 at 04:59:51PM -0800, Phil Carmody wrote:
> --- Juho Snellman <jsn...@iki.fi> wrote:
> > Phil Carmody <thefa...@yahoo.co.uk> writes:
> > > -p0 s/^((.*)(.*)
> > > (?=\2.\3
> > > |$))*$//
> >
> > Assuming the last line is also newline-terminated:
>
> Fair assumption
>
> > -n0 a//^((.*)(.*
> > )(?=\2.\3|$))*$/
>
> Kiitos, Juho.
>
> That's gone beyond my perl ken! Was this the expected failure outcome?
>
> $ echo -e "1\n12\n173\n" | perl -n0 -e 'a//^((.*)(.*
> )(?=\2.\3|$))*$/'
> Illegal division by zero at -e line 1, <> chunk 1.

I believe that should be -p0 s/...//, rather than -n0 a//.../. It's the
same as yours, except with the newline matched as part of \3 to save a
character.

Ronald

Phil Carmody

unread,
Jan 17, 2007, 4:47:32 AM1/17/07
to go...@perl.org

1//regexp/ would crash on the same thing that s/regexp// fails to blank.
So I thought that might be the intended (not space-saving) technique with
a rather bizarre unnecessary use of an unquoted literal to add confusion!
But a typo seems to make more sense.
The large-input behaviour remains a worry. So my modification of Ton's is
what I shall publish.

Phil


() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265

Ton Hospel

unread,
Jan 17, 2007, 4:59:37 AM1/17/07
to go...@perl.org
In article <139073....@web25410.mail.ukl.yahoo.com>,

Phil Carmody <thefa...@yahoo.co.uk> writes:
> $ echo -e "1\n12\n173\n" | perl -n0 -e 'a//^((.*)(.*
> )(?=\2.\3|$))*$/'
> Illegal division by zero at -e line 1, <> chunk 1.

Yes, it was the expected failure outcome

>
> Unfortunately it looks like it fails to even finish my 2400-line file - what's
> its Big-Oh? :
>
> $ time perl -n0 -e 'a//^((.*)(.*
> )(?=\2.\3|$))*$/' < delsieve.log
>

We are golfers, we don't do efficient :-)

The problem is that regex is not intelligent enough to
know that once you matches for a line, that's good
enough for always.

-p0 s/\G(.*)(.*
)(?=\1.\2|$)//g

This should be about as efficient as a simple regex
approach gets. It's also the shortest yet :-)
It outputs starting from the first line that can't
be extended. No output means all lines work.

Juho Snellman

unread,
Jan 17, 2007, 6:25:20 AM1/17/07
to go...@perl.org
Phil Carmody <thefa...@yahoo.co.uk> writes:
> 1//regexp/ would crash on the same thing that s/regexp// fails to blank.
> So I thought that might be the intended (not space-saving) technique with
> a rather bizarre unnecessary use of an unquoted literal to add confusion!
> But a typo seems to make more sense.

Typoing two characters and still ending up with a program that
implements the - admittedly loose - spec seems pretty unlikely :-) I
just liked the looks of the a/// operator.

--
Juho Snellman

Phil Carmody

unread,
Jan 17, 2007, 7:13:22 AM1/17/07
to go...@perl.org
--- Ton Hospel <perl...@ton.iguana.be> wrote:
> -p0 s/\G(.*)(.*
> )(?=\1.\2|$)//g
>
> This should be about as efficient as a simple regex
> approach gets. It's also the shortest yet :-)
> It outputs starting from the first line that can't
> be extended. No output means all lines work.

Excellent! That's more useful output too!
31 chars for the alien!

There seemed to be a bug in previous versions (though to be honest not a
serious one, one that could be considered as inviting a loosening of the
specification) - if you added an extra blank line between two real lines, it
would still pass. Funnily enough, my log file did have such a blank line.
It also crashed on my 2500-line file. Your current one doesn't crash.

Many thanks, all!
Phil

() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index

Daniel Tiefnig

unread,
Jan 17, 2007, 7:16:30 AM1/17/07
to go...@perl.org
Ton Hospel wrote:
> -p0 s/\G(.*)(.* )(?=\1.\2|$)//g
>
> This should be about as efficient as a simple regex approach gets.
> It's also the shortest yet :-) It outputs starting from the first
> line that can't be extended. No output means all lines work.

If you're free to output whatever you want on mismatch, you can also
just omit the "\G".

-p0 s/\G(.*)(.*
)(?=\1.\2|$)//g

Will print all lines that preceed invalid changes. (As requested!) One
can create files that will make some problems, though. If a line does
not add at least one character, strange things may happen. But I think
it will always output something.
And until someone proves the contrary, I consider this being the
shortest solution so far. :o)

lg,
daniel

Ton Hospel

unread,
Jan 17, 2007, 7:47:46 AM1/17/07
to go...@perl.org
In article <732082....@web25412.mail.ukl.yahoo.com>,

Phil Carmody <thefa...@yahoo.co.uk> writes:
> There seemed to be a bug in previous versions (though to be honest not a
> serious one, one that could be considered as inviting a loosening of the
> specification) - if you added an extra blank line between two real lines, it
> would still pass. Funnily enough, my log file did have such a blank line.
> It also crashed on my 2500-line file. Your current one doesn't crash.
>
Mm, it shouldn't. Nor can I reproduce that.

Ton Hospel

unread,
Jan 17, 2007, 8:09:30 AM1/17/07
to go...@perl.org
In article <45AE139E...@gmx.at>,

Daniel Tiefnig <d...@gmx.at> writes:
> If you're free to output whatever you want on mismatch, you can also
> just omit the "\G".
>
> -p0 s/(.*)(.*

> )(?=\1.\2|$)//g
>
> Will print all lines that preceed invalid changes. (As requested!) One
> can create files that will make some problems, though. If a line does
> not add at least one character, strange things may happen. But I think
> it will always output something.
> And until someone proves the contrary, I consider this being the
> shortest solution so far. :o)
>

Correct. It outputs at least the first char of a non-extendable line or
the newline after it if that line is empty.

By the way, what these programs don't check is if the first line is a
single character. The challenge statement is unclear on if the first
line should be seen as an extension of a ghost empty line or not.

Phil Carmody

unread,
Jan 17, 2007, 8:54:26 AM1/17/07
to go...@perl.org
--- Ton Hospel <perl...@ton.iguana.be> wrote:
> By the way, what these programs don't check is if the first line is a
> single character. The challenge statement is unclear on if the first
> line should be seen as an extension of a ghost empty line or not.

Not a requirement. This lets me check slices of my log file a bit at a time
(it's growing every few minutes...).

Phil

() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

Ronald J Kimball

unread,
Jan 17, 2007, 12:53:15 PM1/17/07
to Juho Snellman, go...@perl.org

That was too clever for me I guess. :)

Ronald

Daniel Cutter

unread,
Jan 17, 2007, 2:04:37 PM1/17/07
to go...@perl.org
I was just wondering, reading all your talk about your solutions to the
fonality golf, I would assume that everyone converted in arabic,
calculated and then converted back to roman. When I first had a look at
the problem I thought that that would be the obvious way to do it. At
the time I thought it would be shorter though to calculate in roman and
just drop the conversion. My first solution was with all the conversion.
I say that Ton had allready posted a 100 so I thought he must have gone
the other way. So I tried. My best solution (247) did just that. Based
on the Wikipedia article I tried to add and subtract the roman numerals
directly. Did anybody else do that?

--
Daniel Cutter
use Convert::Morse q!as_ascii!;$d=q!%-";_:;."=.L<o.=fo=:..<=>|>_;.|!;for
(split/!/,'. !> -!o ; |!Lf --""!_% !<::!, %!"- != %!|%;!:;;!f-;!%;-!;.')
{($a,$b)=/(.)(.+)/;$d=~s!\Q$a!$b!g}$_=as_ascii$d;s!(\w+)!\u\L$1!g;;print


Jasper

unread,
Jan 17, 2007, 2:17:03 PM1/17/07
to Daniel Cutter, go...@perl.org
On 1/17/07, Daniel Cutter <dan...@agac.de> wrote:
> I was just wondering, reading all your talk about your solutions to the
> fonality golf, I would assume that everyone converted in arabic,
> calculated and then converted back to roman. When I first had a look at
> the problem I thought that that would be the obvious way to do it. At
> the time I thought it would be shorter though to calculate in roman and
> just drop the conversion. My first solution was with all the conversion.
> I say that Ton had allready posted a 100 so I thought he must have gone
> the other way. So I tried. My best solution (247) did just that. Based
> on the Wikipedia article I tried to add and subtract the roman numerals
> directly. Did anybody else do that?

I had a solution that had bits that incremented and decremented a
roman numeral. That way I could add to or subtract from the first
number while decrementing the second until the second was zero. And so
on.

I think I got to around 220/230 with this method. I don't have it on
me, either, and I think it was a blind alley I went up at one stage,
so I probably won't have submitted it..

But the method to add or subtract directly in RN just seemed far too
complicated to me.

Jasper

p.s.
for($f=12;$f-->0;){
surely
for($f=12;--$f;){
?

Andrew Savige

unread,
Jan 17, 2007, 3:35:38 PM1/17/07
to Jasper, Daniel Cutter, go...@perl.org
--- Jasper wrote:
> p.s.
> for($f=12;$f-->0;){
> surely
> for($f=12;--$f;){
> ?

p.p.s. Mr Magoo. I think you meant for($f=12;$f--;)

For cheap thrills, I fixed a few more Magoos, whittling dcutter's 247 to 237:

#!perl -aln
@a=(IV,IX,XL,XC,CD,CM,M,D,C,L,X,V);@b=(I,VI,X,LX,C,DC,DD,CC,LL,XX,VV,II);s/[IXC]\b/$&x4/efor@b;for(@F){for$f(0..12){s/$a[$f]/$b[$f]/g}}($r)=@F;$d++,/p/and$r.=$F[$d]or$r=~s/$F[$d]//for@F;for($f=12;$f--;){$r=~s/$b[$f]/$a[$f]/g}print$r

Daniel, though, in desperation, I did think of doing it this way, a quick
analysis convinced me that not even ô Great Ton could whittle this approach
down to 100. So I didn't pursue it further. It just seemed crazy to me not
to exploit the 4-stroke eval to do the arithmetic.

Generally, I think it's best not to waste too much energy wondering what
the photon ô Great Ton is doing, and just focus on working the problem.
In my case, realizing that you only need to write one converter was the
biggest breakthrough.

Cheers,
/-\


Send instant messages to your online friends http://au.messenger.yahoo.com

Ton Hospel

unread,
Jan 17, 2007, 3:44:02 PM1/17/07
to go...@perl.org
In article <45AE7345...@agac.de>,

Daniel Cutter <dan...@agac.de> writes:
> I was just wondering, reading all your talk about your solutions to the
> fonality golf, I would assume that everyone converted in arabic,
> calculated and then converted back to roman. When I first had a look at
> the problem I thought that that would be the obvious way to do it. At
> the time I thought it would be shorter though to calculate in roman and
> just drop the conversion. My first solution was with all the conversion.
> I say that Ton had allready posted a 100 so I thought he must have gone
> the other way. So I tried. My best solution (247) did just that. Based
> on the Wikipedia article I tried to add and subtract the roman numerals
> directly. Did anybody else do that?
>

I thought about it, made an estimate about how short it would be
possible to get that and decided not to pursue it. If the challenge
had been for addition only, I would have tried though, because I
think it's mainly subtraction that's icky. I think addition only would
have made the fonality golf more interesting.

Andrew Savige

unread,
Feb 3, 2007, 9:22:49 PM2/3/07
to Ton Hospel, go...@perl.org
--- ô Great Ton wrote:
> In article <1167919268....@i15g2000cwa.googlegroups.com>,
> "Robin Houston" <robin....@gmail.com> writes:
>> On the subject of new golf, I wonder if you golfers all know about
>> http://codegolf.com?
>>
>> The rules are not quite the same as traditional Perl golf: the most
>> important difference is that the whole of the shebang line counts
>> towards the size, which effectively penalises the use of switches
>> by seven strokes ("#!perl" + the newline) and makes the }{ business
>> less useful.
>
> That's the major issue stopping me.
> A 7 stroke penalty to use options is just too much.

Agreed.

However, the biggest problem with this site is that:

Challenges are always open

This regrettable rule ruins the game of golf because:

1) It robs you of the joy of the post mortem: the joy of learning new
Perl tricks, the joy of discovering what the heck ô Great Ton was
up to, and perhaps the greatest joy of all, the joy of teasing
`/anick about making a blunderific Mr Magoo ... again.

2) It imposes no limit on how much time you spend on a challenge.
Though perhaps not a problem for well-adjusted folks, I fear an
obsessive personality may spend far more time than they can afford
on a challenge, resulting in chronic distress in their personal life.
With the traditional one week tournament, at least you are strictly
limited in how much time you waste.

Yanick Champoux

unread,
Feb 4, 2007, 2:21:45 PM2/4/07
to go...@perl.org, Andrew Savige
On Saturday 03 February 2007 21:22, Andrew Savige wrote:
> --- ô Great Ton wrote:
> > In article <1167919268....@i15g2000cwa.googlegroups.com>,
> >
> > "Robin Houston" <robin....@gmail.com> writes:
> >> On the subject of new golf, I wonder if you golfers all know about
> >> http://codegolf.com?
> >>
> >> The rules are not quite the same as traditional Perl golf: the most
> >> important difference is that the whole of the shebang line counts
> >> towards the size, which effectively penalises the use of switches
> >> by seven strokes ("#!perl" + the newline) and makes the }{ business
> >> less useful.
> >
> > That's the major issue stopping me.
> > A 7 stroke penalty to use options is just too much.
>
> Agreed.

You know, I'm pretty sure that if I was to visit some remote region of
Scotland, I'd find a pub. In that pub, I'm fairly certain I'd find a
congregation of old geezers, comfortably seated at a table in the back and
craddling pints of bitter in diverse states of draininess. And if I
discreetly, very discreetly scoot close to that group and perk my ear, I'd
probably hear them passionately bemoan how those darned foreigners are
butchering that old, venerable sport that Golf is...


(I'd like to say that this parallel was meant to bring in the point of
acceptance and tolerance of diversity, but the truth is, the mental image of
everyone present wearing kilt just cracks me up ;-) )


> Challenges are always open
>
> This regrettable rule ruins the game of golf because:
>
> 1) It robs you of the joy of the post mortem: the joy of learning new
> Perl tricks, the joy of discovering what the heck ô Great Ton was
> up to, and perhaps the greatest joy of all, the joy of teasing
> `/anick about making a blunderific Mr Magoo ... again.

As if you ever needed to see my code to tease me in the first place. ;-P

True, the Codegolf challenges does bereft the contestants of all those fun,
not to mention educative, collaterals. But, on the other hand, they do allow
for contemplative golfing. Without a time limit, one can grow one's solution
like a bonzai tree. Slowly nipping a character here, binding an algorithm
there, and generally returning to it whenever one feels the need for a little
code Zen.

> 2) It imposes no limit on how much time you spend on a challenge.
> Though perhaps not a problem for well-adjusted folks, I fear an
> obsessive personality may spend far more time than they can afford
> on a challenge, resulting in chronic distress in their personal life.
> With the traditional one week tournament, at least you are strictly
> limited in how much time you waste.

Pfah. Humbug! Golfing is not *that* addictive. You just have to-- hey, did
they posted a new entry this morning? Ooooh... A Roman-to-decimal rehash of
the Fonality tournament. Aah.. Emm... Do you mind if we pursue this
conversation later on? I suddenly remember I have things to do...


Joy,
`/anick

Andrew Savige

unread,
Feb 11, 2007, 2:17:42 PM2/11/07
to Yanick Champoux, go...@perl.org, Andrew Savige
`/anick wrote:
> Ooooh... A Roman-to-decimal rehash of the Fonality tournament.
> Aah.. Emm... Do you mind if we pursue this conversation later on?
> I suddenly remember I have things to do...

Thanks `/ for bringing that to my attention. I need another golf game
like a hole in the head. ;-) As you might have guessed, I could not
restrain myself from gazing at the magic of the Earthman code lamp
from the opposite direction.

Though I really enjoyed that eye-popping experience, I'm now ready for
the post mortem, to enjoy all the weird and wonderful approaches of the
other contestants ... except there isn't one. Oh well, I notice many
others have complained about this and the site owners have promised to
close challenges and publish the solutions eventually ... when no doubt
we'll see a rash of Ton/Mtve "deep post mortem" improvements to the
winning solutions. :-)

> And if I discreetly, very discreetly scoot close to that group and perk
> my ear, I'd probably hear them passionately bemoan how those darned
> foreigners are butchering that old, venerable sport that Golf is...

Yep, I just stumbled on another butchering on the discussion board
http://codegolf.com/boards/conversation/view/98:

"Milk holes in the tests as much as you want"

Compare that abomination to the gentlemanly conduct of the traditional
game, where exploiting holes in the test program risks excommunication
and where the proper response is to alert the (human) referee with a
test case plugging the hole. You can't replace the traditional human
golf referee with a robot.

Yanick Champoux

unread,
Feb 13, 2007, 11:15:25 PM2/13/07
to Andrew Savige, go...@perl.org
On Sunday 11 February 2007 14:17, Andrew Savige wrote:
> `/anick wrote:
> > Ooooh... A Roman-to-decimal rehash of the Fonality tournament.
> > Aah.. Emm... Do you mind if we pursue this conversation later on?
> > I suddenly remember I have things to do...
>
> Thanks `/ for bringing that to my attention. I need another golf game
> like a hole in the head. ;-)

Ooops. Sorry, I didn't mean to tempt you back into the time-warping hell of
golf addiction.

This being said, if you need help to wean off this addiction, I recommend
joining me to my current retreat. The staff is not terribly convivial (Sister
Gertrude, I am pained to say, has bedside manners as rough as her
five-o'clock shadow), but the accomodations are superlative (everything --
not only the couches but all furnitures and walls -- is soft, plushy and
padded) and the drinks to kill for (my current favorite is the Barbituric
Sunrise).

> > And if I discreetly, very discreetly scoot close to that group and perk
> > my ear, I'd probably hear them passionately bemoan how those darned
> > foreigners are butchering that old, venerable sport that Golf is...
>
> Yep, I just stumbled on another butchering on the discussion board
> http://codegolf.com/boards/conversation/view/98:
>
> "Milk holes in the tests as much as you want"
>
> Compare that abomination to the gentlemanly conduct of the traditional
> game, where exploiting holes in the test program risks excommunication
> and where the proper response is to alert the (human) referee with a
> test case plugging the hole. You can't replace the traditional human
> golf referee with a robot.

I'll give you that this approach -- while being understandable considering
the desire to have the competition being self-arbitrated -- lacks the panache
and gentlemanish flair of our traditional Perl golfs. Nonetheless, I still
maintain that they provide a good driving range where one can keep his or her
swing in shape for the next big event (and sink vast amounts of time that
could otherwise been used for worthy causes).

Joy,
`/anick

0 new messages