line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Freecell::Deal::MS; |
2
|
|
|
|
|
|
|
$Freecell::Deal::MS::VERSION = '0.0.1'; |
3
|
1
|
|
|
1
|
|
68289
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
487
|
use Math::RNG::Microsoft (); |
|
1
|
|
|
|
|
3895
|
|
|
1
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Class::XSAccessor { |
9
|
1
|
|
|
|
|
5
|
constructor => 'new', |
10
|
|
|
|
|
|
|
accessors => [qw(deal)], |
11
|
1
|
|
|
1
|
|
7
|
}; |
|
1
|
|
|
|
|
2
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub as_str |
14
|
|
|
|
|
|
|
{ |
15
|
1
|
|
|
1
|
1
|
519
|
my ($self) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @cards = ( |
18
|
|
|
|
|
|
|
map { |
19
|
1
|
|
|
|
|
4
|
my $s = $_; |
|
13
|
|
|
|
|
16
|
|
20
|
13
|
|
|
|
|
16
|
map { $s . $_ } qw/C D H S/; |
|
52
|
|
|
|
|
94
|
|
21
|
|
|
|
|
|
|
} ( 'A', ( 2 .. 9 ), 'T', 'J', 'Q', 'K' ) |
22
|
|
|
|
|
|
|
); |
23
|
1
|
|
|
|
|
12
|
Math::RNG::Microsoft->new( seed => scalar( $self->deal ) ) |
24
|
|
|
|
|
|
|
->shuffle( \@cards ); |
25
|
1
|
|
|
|
|
472
|
my @lines = ( map { [ ':', ] } 0 .. 7 ); |
|
8
|
|
|
|
|
15
|
|
26
|
1
|
|
|
|
|
3
|
my $i = 0; |
27
|
1
|
|
|
|
|
3
|
while (@cards) |
28
|
|
|
|
|
|
|
{ |
29
|
52
|
|
|
|
|
62
|
push @{ $lines[$i] }, pop(@cards); |
|
52
|
|
|
|
|
80
|
|
30
|
52
|
|
|
|
|
93
|
$i = ( ( $i + 1 ) & 7 ); |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
2
|
my $str = join "", map { "@$_\n" } @lines; |
|
8
|
|
|
|
|
23
|
|
33
|
1
|
|
|
|
|
8
|
return $str; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |