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

Re: TPR1 post-mortem

Thread Previous | Thread Next
From:
Stephen Turner
Date:
March 8, 2002 10:27
Subject:
Re: TPR1 post-mortem
Message ID:
Pine.LNX.3.96.1020308114949.16059B-100000@gentoo
I've looked quickly at all the entries up to 55 strokes, and identified the
following methods for difficult bits of the problem. Apologies for errors
and omissions!

Methods for pulling off all pairs of characters:

s/./ ___&`%10+$&___ /g   (Ton-47, Jukka-50, Rick-51, ~Chris-53, Andrew-53,
                          Lyon-54, Jasper-55, Xavier-55)
s|.| ___$&___ if/../g|   (MTV-49)
/(?=(..)./               (Ton-52, Rick-52, Jukka-53, Antti-55, Adam-55)
/..(?{ ___$&___ })/      (Stephen-54, Eugene-55)

Methods for calculating the new digit:

hex($1+$2)%15             (Ton-47, Chris-53)
$x%9||9x$x&9              (MTV-49)
$x*1.11%10                (~Jukka-50, Rick-51, Ton-52)
chop($x)+$x               (Andrew-53)
$x%9||9*!!-$x             (Stephen-54)
(0..9,1..9)[$x]           (Lyon-54)
-$x?$x%9||9:0             (Antti-55)
$x%9||0+$x&&9             (MTV-54, Adam-54, Ton-55, Eugene-55, Adam-55)

(I really like $x*1.11%10. That would have saved me three strokes!)

Methods for looping:

while                     (Ton-47, Chris-53a, Andrew-53, Adam-54, Antti-55,
                           Eugene-55, Jasper-55, Xavier-55)
do$0                      (A different Ton-47)
s///g inside s///         (MTV-49, Jukka-50, Rick-51, Chris-53b, Lyon-54
`$^X $0`                  (Stephen-54)

-- 
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



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About