line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BettingStrategy::MonteCarlo; |
2
|
4
|
|
|
4
|
|
667200
|
use 5.008001; |
|
4
|
|
|
|
|
31
|
|
3
|
4
|
|
|
4
|
|
23
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
76
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
89
|
|
5
|
4
|
|
|
4
|
|
1738
|
use version; our $VERSION = version->declare("v0.1.0"); |
|
4
|
|
|
|
|
7578
|
|
|
4
|
|
|
|
|
23
|
|
6
|
4
|
|
|
4
|
|
2629
|
use Moo; |
|
4
|
|
|
|
|
44960
|
|
|
4
|
|
|
|
|
21
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has array => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
default => sub { +[1, 2, 3] } |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has magnification => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
default => 2, |
16
|
|
|
|
|
|
|
isa => sub { |
17
|
|
|
|
|
|
|
die 'invalid magnification' unless $_[0]; |
18
|
|
|
|
|
|
|
die 'magnification is 2 or 3' unless ($_[0] == 2 or $_[0] == 3); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub bet { |
23
|
34
|
|
|
34
|
0
|
11305
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
34
|
100
|
|
|
|
83
|
die 'finished' if $self->is_finished; |
26
|
31
|
|
|
|
|
144
|
return $self->array->[0] + $self->array->[-1]; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub lost { |
30
|
14
|
|
|
14
|
0
|
1671
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
14
|
100
|
|
|
|
45
|
die 'finished' if $self->is_finished; |
33
|
11
|
|
|
|
|
21
|
push @{$self->array}, $self->bet; |
|
11
|
|
|
|
|
35
|
|
34
|
11
|
|
|
|
|
25
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub won { |
38
|
12
|
|
|
12
|
0
|
2729
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
12
|
100
|
|
|
|
38
|
die 'finished' if $self->is_finished; |
41
|
9
|
|
|
|
|
63
|
for (2 .. $self->magnification) { |
42
|
12
|
|
|
|
|
21
|
shift @{$self->array}; |
|
12
|
|
|
|
|
27
|
|
43
|
12
|
|
|
|
|
26
|
pop @{$self->array}; |
|
12
|
|
|
|
|
32
|
|
44
|
|
|
|
|
|
|
} |
45
|
9
|
|
|
|
|
30
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
79
|
|
|
79
|
0
|
1681
|
sub is_finished { scalar @{shift->array} <= 1 } |
|
79
|
|
|
|
|
425
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |