line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chess::Elo; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
37030
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
306
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
11
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
12
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# This allows declaration use Chess::Elo ':all'; |
15
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
16
|
|
|
|
|
|
|
# will save memory. |
17
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
18
|
|
|
|
|
|
|
elo |
19
|
|
|
|
|
|
|
) ] ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @EXPORT = qw( |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = '1.0a'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Preloaded methods go here. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $factor = 32; |
33
|
|
|
|
|
|
|
our $divisor = 400; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub elo { |
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
6
|
1
|
3475
|
my ($A, $result, $B) = @_; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
34
|
my $Aexp = 10 ** ( ($B - $A) / $divisor ) ; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
6
|
|
|
|
|
12
|
my $A2 = |
43
|
|
|
|
|
|
|
$A + $factor * ( $result - |
44
|
|
|
|
|
|
|
( 1 / |
45
|
|
|
|
|
|
|
( 1 + $Aexp ) |
46
|
|
|
|
|
|
|
) |
47
|
|
|
|
|
|
|
) |
48
|
|
|
|
|
|
|
; |
49
|
|
|
|
|
|
|
|
50
|
6
|
|
|
|
|
11
|
my $Bexp = 10 ** ( ($A - $B) / $divisor ) ; |
51
|
|
|
|
|
|
|
|
52
|
6
|
|
|
|
|
7
|
$result = 1 - $result; |
53
|
|
|
|
|
|
|
|
54
|
6
|
|
|
|
|
9
|
my $B2 = |
55
|
|
|
|
|
|
|
$B + $factor * ( $result - |
56
|
|
|
|
|
|
|
( 1 / |
57
|
|
|
|
|
|
|
( 1 + $Bexp ) |
58
|
|
|
|
|
|
|
) |
59
|
|
|
|
|
|
|
) |
60
|
|
|
|
|
|
|
; |
61
|
|
|
|
|
|
|
|
62
|
6
|
|
|
|
|
16
|
($A2, $B2) |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
__END__ |