| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*- mode: cperl -*- |
|
2
|
|
|
|
|
|
|
package Chess4p::Move; |
|
3
|
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
30
|
use strict; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
198
|
|
|
5
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
289
|
|
|
6
|
4
|
|
|
4
|
|
50
|
use v5.36; |
|
|
4
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
20
|
use Chess4p::Common; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
218
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
666
|
use overload ('""', => 'uci'); |
|
|
4
|
|
|
|
|
1687
|
|
|
|
4
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
2081
|
|
|
2081
|
1
|
3870
|
my ($class, $from, $to, $promotion) = @_; |
|
14
|
2081
|
|
|
|
|
2880
|
my $href = {}; |
|
15
|
2081
|
|
|
|
|
3756
|
$href->{from} = $from; |
|
16
|
2081
|
|
|
|
|
3222
|
$href->{to} = $to; |
|
17
|
2081
|
|
|
|
|
2939
|
$href->{promotion} = $promotion; |
|
18
|
2081
|
|
|
|
|
6690
|
return bless $href, $class; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub from { ## no critic (Subroutines::RequireArgUnpacking) |
|
22
|
1399
|
|
|
1399
|
1
|
7046
|
return $_[0]->{from}; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub to { ## no critic (Subroutines::RequireArgUnpacking) |
|
26
|
1521
|
|
|
1521
|
1
|
4636
|
return $_[0]->{to}; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub promotion { ## no critic (Subroutines::RequireArgUnpacking) |
|
30
|
1323
|
|
|
1323
|
1
|
2821
|
return $_[0]->{promotion}; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub uci { ## no critic (Subroutines::RequireArgUnpacking) |
|
34
|
1251
|
|
|
1251
|
1
|
4792
|
my $result = "$Chess4p::Board::square_names{$_[0]->from()}$Chess4p::Board::square_names{$_[0]->to()}"; |
|
35
|
1251
|
100
|
|
|
|
2485
|
$result .= lc($_[0]->promotion()) if defined $_[0]->promotion(); |
|
36
|
1251
|
|
|
|
|
4574
|
return $result; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |