P is for Practical PerlMonks

Compression in Golf: Part II

by eyepopslikeamosquito (Chancellor)
 on Oct 06, 2012 at 07:18 UTC Need Help??

```# original 96-stroke solution
\$c[\$_*=.52,5.5-4.7*cos][8+7.4*sin]=(\$_^\$`%12?o:x)&(\$_^\$'/5?o:'}')for<>
+!~/:/..11;print"@\$_
...
# 102-stroke pack-friendly makeover
map\$c[\$_*=.52,5.5-4.7*cos][8+7.4*sin]=(\$`%12^\$_?o:x)&(\$'/5^\$_
?o:v125),0..s//<>/e./:/;print"@\$_\n"for@c#```
```
```@c=(@b=(++\$n,bottle.'s'x@-,of,beer),on,the,wall),s//Take one down and
+pass it around, @c.

@c, @b.
/until/, 99\D+/;print\$'."Go to the store and buy some more\$&"
```
```@m=(@z=(++\$n,bottle.\$&,of,beer),on,the,wall),s/^/,\$"@m.\n\n@m,\$"@z.\n\
+u@j/until@j=/s/?(take,one,down,an.d,pass,it,around):(go,to,the,store,
```
```s//\utakevonevdownvandvpassvitvaround,v@s.__/until@s=(@b=++\$s.vbottle.
+"s"x@b.vofvbeer,onvthevwall),s//@s,v@b._/,/99/;s/\$/\ugovtovthevstorev
```
```\$_=v71.ovtovthevstorevandvbuyvsomevmore;@z=(\$b=++\$n.vbottle."s"x@+.vof
+vbeer,onvthevwall),s;^;\utakevonevdownvandvpassvitvaround,v@z.\n\n@z,
+v\$b.\n;,y/v/\40/until/,.99[^9]*/;print\$'.\$&
```
```#        1         2         3         4         5         6         7
#234567890123456789012345678901234567890123456789012345678901234567890
+123
...
;,y/v/\40/until/,.99[^9]*/;print\$'.\$&
#234567890123456789012345678901234567
#        1         2         3
```
```s;^;\utakevonevdownvandvpassvitvaround,v@z.\n\n@z,v\$b.
;
```
```my \$source = <<'PERSEVEROUS';
+of.
...
open my \$fh, '>', 'b.pl' or die "error: open b.pl: \$!";
binmode \$fh;
print \$fh "eval lc pack u54,'" . \$out . "'";
```

Create A New User
Node Status?
node history
Node Type: perlmeditation [id://997591]
Approved by Athanasius
Front-paged by Athanasius
help
Chatterbox?
 [ambrus]: [Corion]: ambrus: Oh - that one would be much harder to automate... The SYNOPSIS section should mostly be a runnable program IMO, but I write only small snippets in my documentation for single functions/methods, and creating the appropriate environment for ... [Corion]: ... those in an automated fashion seems somewhat hard to me. Although it should do wonders for the test coverage ;) [haukex]: Corion: I once wrote an automated thingy for that here [haukex]: here's the code that uses it [Corion]: haukex: Hmm - maybe I can reuse that. I see that it uses Pod::Parser, which I think was one of the more fragile parsers. But if I'm statically (re)generating the tests instead of doing that "live" on the client/tester machines, that's a much smaller... [Corion]: ... problem space than trying to cater to all versions of Pod::Parser(s)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-02-27 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Before electricity was invented, what was the Electric Eel called?

Results (385 votes). Check out past polls.