line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#! /bin/false |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Copyright (C) 2019 Guido Flohr , |
4
|
|
|
|
|
|
|
# all rights reserved. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# This program is free software. It comes without any warranty, to |
7
|
|
|
|
|
|
|
# the extent permitted by applicable law. You can redistribute it |
8
|
|
|
|
|
|
|
# and/or modify it under the terms of the Do What the Fuck You Want |
9
|
|
|
|
|
|
|
# to Public License, Version 2, as published by Sam Hocevar. See |
10
|
|
|
|
|
|
|
# http://www.wtfpl.net/ for more details. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Chess::Opening::Book::Move; |
13
|
|
|
|
|
|
|
$Chess::Opening::Book::Move::VERSION = '0.6'; |
14
|
3
|
|
|
3
|
|
22
|
use common::sense; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
17
|
|
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
159
|
use Locale::TextDomain 'com.cantanea.Chess-Opening'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
16
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
289
|
|
|
289
|
1
|
751
|
my ($class, %args) = @_; |
20
|
|
|
|
|
|
|
|
21
|
289
|
50
|
|
|
|
587
|
if (!exists $args{move}) { |
22
|
0
|
|
|
|
|
0
|
require Carp; |
23
|
0
|
|
|
|
|
0
|
Carp::croak(__x("the named argument '{arg}' is required", |
24
|
|
|
|
|
|
|
arg => 'move')); |
25
|
|
|
|
|
|
|
} |
26
|
289
|
50
|
|
|
|
913
|
if ($args{move} !~ /^[a-h][1-8][a-h][1-8][qrbn]?$/) { |
27
|
0
|
|
|
|
|
0
|
require Carp; |
28
|
0
|
|
|
|
|
0
|
Carp::croak(__x("invalid move '{move}'", |
29
|
|
|
|
|
|
|
move => '$args{move}')); |
30
|
|
|
|
|
|
|
} |
31
|
289
|
50
|
66
|
|
|
1336
|
if (exists $args{count} && $args{count} |
|
|
|
33
|
|
|
|
|
32
|
|
|
|
|
|
|
&& $args{count} !~ /^[1-9][0-9]*$/) { |
33
|
0
|
|
|
|
|
0
|
require Carp; |
34
|
0
|
|
|
|
|
0
|
Carp::croak(__"count must be a positive integer"); |
35
|
|
|
|
|
|
|
} |
36
|
289
|
|
100
|
|
|
673
|
$args{count} ||= 1; |
37
|
289
|
100
|
|
|
|
586
|
$args{learn} = '0' if !exists $args{learn}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
bless { |
40
|
|
|
|
|
|
|
__move => $args{move}, |
41
|
|
|
|
|
|
|
__count => $args{count}, |
42
|
|
|
|
|
|
|
__learn => $args{learn}, |
43
|
289
|
|
|
|
|
1349
|
}, $class; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
1
|
0
|
sub weight { shift->{__count} } |
47
|
312
|
|
|
312
|
1
|
741
|
sub count { shift->{__count} } |
48
|
23
|
|
|
23
|
1
|
11253
|
sub move { shift->{__move} } |
49
|
23
|
|
|
23
|
1
|
140
|
sub learn { shift->{__learn} } |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |