human.pl: 204 strokes
shuffle.pl: 51 strokes
select.pl: 55 strokes
------------------------
total: 310 strokes
human.pl:
print map{$$_[0]}sort{$$b[1]!~/\D/<=>$$a[1]!~/\D/||(grep$_,map{$_>@$b?
+1:($@=($$a
[$_]!~/\D/&&length$$a[$_]<=>length$$b[$_])||$$a[$_]cmp$$b[$_])?$@:0}1.
+.@$a)[0]}s
ort{@$b<=>@$a}map{[$_,split/(\d+|\n)/,lc]}<>
shuffle.pl:
print map{$n=rand@x;@x[$n,-1]=@x[-1,$n];pop@x}@x=<>
select.pl:
@x=<>;print map{$n=rand@x;@x[$n,-1]=@x[-1,$n];pop@x}0,1
|
Update:
human.pl: 189 strokes
shuffle.pl: 33 strokes
select.pl: 37 strokes
------------------------
total: 259 strokes
human.pl:
print map{$$_[0]}sort{$$b[1]!~/\D/<=>$$a[1]!~/\D/||(grep$_,map{$,=$$a[
+$_];$_>@$b
||($,!~/\D/&&length$,<=>length$$b[$_])||$,cmp$$b[$_]}1..@$a)[0]}sort{@
+$b<=>@$a}
map{[$_,split/(\d+|\n)/,lc]}<>
This passes, but doesn't look right. It does cut 15 strokes, though:
print map{$$_[0]}sort{$$b[1]!~/\D/<=>$$a[1]!~/\D/||(grep$_,map{$,=$$a[
+$_];$_>@$b
||($,!~/\D/&&length$,<=>length$$b[$_])||$,cmp$$b[$_]}1..@$a)[0]}map{[$
+_,split/(\
d+|\n)/,lc]}<>
shuffle.pl:
print map{splice@x,rand@x,1}@x=<>
select.pl:
@x=<>;print map{splice@x,rand@x,1}0,1
|
Update2:
human.pl: 185 strokes
human.pl:
print map$$_[0],sort{$$b[1]!~/\D/<=>$$a[1]!~/\D/||(grep$_,map$_>@$b||(
+($*=$$a[$_
])!~/\D/&&length$*<=>length$$b[$_])||$*cmp$$b[$_],1..@$a)[0]}sort{@$b<
+=>@$a}map[
$_,split/(\d+|\n)/,lc],<>
|
Update3:
human.pl: 159 strokes
human.pl:
print map$$_[0],sort{(grep$_,map$_>@$b||((!grep/\D/,$*=$$a[$_],$_=$$b[
+$_])&&leng
th$*<=>length)||$*cmp$_,1..@$a)[0]}sort{@$b<=>@$a}map[$_,split/(\d+|\n
+)/,lc],<>
|
Update3:
human.pl: 137 strokes
human.pl:
print map$$_[0],sort{(grep$_,map{((!grep/\D/,$*=$$a[$_],$_=$$b[$_])&&l
+ength$*<=>
length)||$*cmp$_}1..@$a)[0]}map[$_,split/(\d+|\n)/,lc],<>
|
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.