line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
892
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Games::Goban::Board; |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$Games::Goban::Board::VERSION = '1.102'; |
7
|
|
|
|
|
|
|
} |
8
|
1
|
|
|
1
|
|
688
|
use parent qw(Games::Board::Grid); |
|
1
|
|
|
|
|
331
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: a go board built from Games::Board |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $origin = ord('a'); |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
1
|
1105
|
sub piececlass { 'Games::Goban::Piece' } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
2
|
|
|
2
|
1
|
1229
|
my ($self, %opts) = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
13
|
my $board = $self->SUPER::new(%opts); |
21
|
2
|
100
|
|
|
|
54
|
$board->{skip_i} = defined $opts{skip_i} ? $opts{skip_i} : 0; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
8
|
$board; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub index2id { |
27
|
728
|
|
|
728
|
1
|
23005
|
my ($self, $loc) = @_; |
28
|
|
|
|
|
|
|
|
29
|
728
|
|
|
|
|
1270
|
my $id = chr($origin + $loc->[0]) . chr($origin + $loc->[1]); |
30
|
|
|
|
|
|
|
|
31
|
728
|
100
|
|
|
|
1368
|
$id =~ tr/[i-s]/[j-t]/ if $self->{skip_i}; |
32
|
|
|
|
|
|
|
|
33
|
728
|
|
|
|
|
1664
|
$id; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub id2index { |
37
|
7
|
|
|
7
|
1
|
2637
|
my ($self, $id) = @_; |
38
|
|
|
|
|
|
|
|
39
|
7
|
100
|
|
|
|
21
|
$id =~ tr/[j-t]/[i-s]/ if $self->{skip_i}; |
40
|
|
|
|
|
|
|
|
41
|
7
|
|
|
|
|
22
|
my @loc = split //, $id; |
42
|
|
|
|
|
|
|
|
43
|
7
|
|
|
|
|
26
|
$_ = ord($_) - $origin for @loc; |
44
|
7
|
|
|
|
|
38
|
\@loc; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package Games::Goban::Piece; |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
$Games::Goban::Piece::VERSION = '1.102'; |
50
|
|
|
|
|
|
|
} |
51
|
1
|
|
|
1
|
|
4797
|
use base qw(Games::Board::Piece); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
246
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $next_id = 0; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub new { |
56
|
2
|
|
|
2
|
|
9
|
my ($class, %args) = @_; |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
33
|
|
|
14
|
$args{id} ||= ++$next_id; |
59
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
16
|
my $self = $class->SUPER::new(%args); |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
37
|
$self->{color} = $args{color}; |
63
|
2
|
|
|
|
|
4
|
$self->{notes} = $args{notes}; |
64
|
2
|
|
|
|
|
4
|
$self->{move} = $args{move}; |
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
|
|
7
|
bless $self => $class; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
|
0
|
sub notes { (shift)->{notes} } |
70
|
4
|
|
|
4
|
|
1035
|
sub position { (shift)->current_space_id } |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
2
|
|
8
|
sub moved_on { (shift)->{move} } |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
2
|
|
755
|
sub color { my $self = shift; $self->{color} } |
|
2
|
|
|
|
|
9
|
|
75
|
2
|
|
|
2
|
|
4
|
sub colour { my $self = shift; $self->{color} } |
|
2
|
|
|
|
|
10
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |