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