Ian Phillipps wrote: > The topic of APL came up today, and I recalled an APL one-liner (about > 150 chars if I recall) that printed a set of 4 Bridge hands in the > conventional layout. As usual, my solution is more brute-force than clever. Think of it as a reference implementation. :-) my @r = ( 1 .. 9, qw( T J Q K ) ); my %r; @r{ @r } = 0 .. $#r; my @d = map { my $s = $_; map { [ $s, $_ ] } @r } qw( S H D C ); for ( reverse 1 .. $#d ) { my $r = int rand $_; @d[$r,$_] = @d[$_,$r] } my @h; for my $i ( 0 .. $#d ) { push @{ $h[$i&3]{ $d[$i][0] } }, $d[$i][1]; } for my $hi ( 0 .. $#h ) { $"=''; $h[$hi] = [ map { "$_: @{[ sort { $r{$b} <=> $r{$a} } @{ $h[$hi]{$_} } ]}" } qw( S H D C ) ]; } print i( $h[0] ), p( $h[3], $h[1] ), i( $h[2] ); sub p { map { sprintf "%-20s%s\n", $_[0][$_], $_[1][$_] } 0..3 } sub i { map { sprintf "%-10s%s\n", '', $_[0][$_]; } 0..3 } -- John Porter Ann wenno haddum billizac... ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe