|
|
Up |
|
|
  |
Author: JasperJasper
Date: Jun 17, 2008 03:44
Hi, y'all,
Can anyone beat 55 on this? I don't know if we ever did it as a
challenge. Should I search for it in the book?
--
Jasper
|
| |
|
| |
no comments
|
|
  |
Author: Zhu ShanshanZhu Shanshan
Date: Jun 11, 2008 20:59
I used perl " v5.8.5 built for i386-linux-thread-multi".
My data:
##################### File:color.txt
chartreuse
deeppink
goldenrod
lightblue
dodgerblue
darkgoldenrod
My scripts:
##################### File: test.pl
use strict;
use warnings;
open IN,"color.txt" or die;
while ( ){
chomp;
print "$_";
}
close IN;
|
| Show full article (1.13Kb) |
|
| |
3 Comments |
|
  |
Author: JasperJasper
Date: May 27, 2008 04:27
Has anyone been golfing the google challenges?
I've got the robot one to around 74 characters (not including the 'use
Math::BigInt' :))
The other one didn't seem all that interesting in comparison..
~~~tumbleweed~~~
--
Jasper
|
| |
|
4 Comments |
|
  |
|
|
  |
Author: Tuomo SaloTuomo Salo
Date: Nov 20, 2007 11:24
This one has no performance issues and is even a little bit shorter. Yay!
#!perl -l
$r=qr/\((??{$r})*\)/;map/^$r+$/&&print,glob"{(,)}"x2x pop
-bass
|
| |
|
3 Comments |
|
  |
Author: Phil CarmodyPhil Carmody
Date: Nov 19, 2007 18:44
--- Tuomo Salo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> - From the keyboard of Phil Carmody (2007-11-15 15:05):
>> I saw this on sci.math, and thought "one liner" ;-)
>
> While I could not squeeze this down to a one 80 char line, there is only
> one line that does not begin with a # :-)
>
> #!perl -l
> $\=~s#(.*)\n#"$1(\n"x($1=~y/(//<$a)."$1)\n"x($1=~y/)//*2<$_-1)#gefor
1..2*($a=pop);print
>
> I tried to do the generation by hand, implemented that method as a
> regex, and polished (or should I say disfigured) the result with a
> couple of standard golfing tricks. Notice the lack of escaped parens,
> btw :-)
>
> There are probably a couple of mrmagoos there, at least you could lose
> a couple of chars (along with any perceived one-linerness) by replacing
> the "\n":s with literal newlines. ...
|
| Show full article (1.26Kb) |
|
no comments
|
|
  |
Author: Phil CarmodyPhil Carmody
Date: Nov 15, 2007 05:05
I saw this on sci.math, and thought "one liner" ;-)
I even think a DP non-recursive approach should be quite quick.
Keeping the output in the logical order might cost a few strokes.
#!/usr/bin/perl
$count = $ARGV[0];
print join "\n", pren($count), "";
sub pren
{
my @list = ();
|
| Show full article (1.93Kb) |
|
8 Comments |
|
  |
Author: Michael YardleyMichael Yardley
Date: Aug 5, 2007 01:09
On Aug 3, 9:35 pm, "_ G O D _" TELUS.NET> wrote:
> WA women inmates allege sex assaults
> Seattle, WA, USA
> The Washington state prison system is
> investigating allegations that four male
> guards at the main women's penitentiary
> sexually assaulted two inmates. ... http://seattlepi.nwsource.com/local/64=
20AP_WA_Inmate_Sex_Probe.html
>
> Prison closure postponed
> Escanaba, MI, USA
> "Michigan has the sixth largest prison system,
> a very high rate of recidivism, and long prison
> stays due to mandatory sentencing guidelines....http://www.dailypress.net=
/stories/articles.asp?articleID=3D12584
> ...
|
| Show full article (6.78Kb) |
|
no comments
|
|
  |
Author: JasperJasper
Date: Jul 17, 2007 06:14
Hey,
I'm looking for a list of the polish golfs, with rules and test
programs, but kernelpanic.pl, where I expected to find them, seems
reluctant to give them up.
I'm just organizizing a little intra-company golf for fun, is all, but
I don't want the overhead of creating a whole compo..
Anyone keep any of this around? Anyone know specifically of a good one
that was fun?
I suppose I could grab one of Terje's golfs that I didn't do instead...
Thanks
--
Jasper
|
| |
|
no comments
|
|
  |
|
|
  |
Author: Roy JohnsonRoy Johnson
Date: Jun 27, 2007 12:26
Mine (borrowing RJK's testing code): $1 will be the last letter (non-underscore) before or at the target location; $2 will be the first letter at or after the target location, or the last letter if no such letter exists.
for (qw/ A_Z_K_ A_____ _____K /) {
print "$_\n";
for my $n (1 .. 6) {
my $r = $n - 1;
print "$n: ";
print /^(?=.{0,$r}([^_]))?.{0,$r}.*?([^_])/
? "[$1] ($2)" : "no match";
print "\n";
}
}
|
| |
|
2 Comments |
|
|
|
|
|
|