| 1 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Games::Goban; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | $Games::Goban::VERSION = '1.102'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Board for playing go, renju, othello, etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | my $ORIGIN = ord('a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | my $piececlass = 'Games::Goban::Piece'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | our %types = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | go => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | othello => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | renju => 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | gomoku => 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | our %defaults = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | game => 'go', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | size => 19, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | white => 'Miss White', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | black => 'Mr. Black', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | skip_i => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 9 | ▶ | referee => sub { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 9 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | my %opts = (%defaults, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 9 | ▶ | unless (($opts{size} !~ /\D/) and ($opts{size} > 4) and ($opts{size} <= 26)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $opts{"size"} =~ /\D/ and $opts{"size"} > 4 and $opts{"size"} <= 26
not $opts{"size"} =~ /\D/ and $opts{"size"} > 4
MC/DC0%0/3
not $opts{"size"} =~ /\D/ and $opts{"size"} > 4 and $opts{"size"} <= 26
not $opts{"size"} =~ /\D/
$opts{"size"} > 4
$opts{"size"} <= 26
Truth table25%1/4
not(A) and B and C
A= not $opts{"size"} =~ /\D/B= $opts{"size"} > 4C= $opts{"size"} <= 26
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | croak "Illegal size $opts{size} (must be integer > 4)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 9 | $opts{game} = lc $opts{game}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 | ▶ | croak "Unknown game $opts{game}" unless exists $types{ $opts{game} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | my $board = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | move => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | moves => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | turn => 'b', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | game => $opts{game}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | size => $opts{size}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | black => $opts{black}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | white => $opts{white}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | skip_i => $opts{skip_i}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | referee => $opts{referee}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | callbacks => {}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | magiccookie => "a0000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | for (0 .. ($opts{size} - 1)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 161 | push @{ $board->{board} }, [ (undef) x $opts{size} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | $board->{hoshi} = $board->_calc_hoshi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | return $board; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | sub move { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 10 | ▶ | my ($self, $move) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
move: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 10 | my ($x, $y) = $self->_pos2grid($move, $self->skip_i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 10 | $self->_check_pos($move); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 9 | my $stat = $self->{referee}->($self, $move); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 9 | ▶ | return $stat if !$stat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | $self->{board}[$x][$y] = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | colour => $self->{turn}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | move => $self->{move}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 9 | xy => [ $x, $y ], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | board => $self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | "Games::Goban::Piece"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | push @{ $self->{moves} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | player => $self->{turn}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 9 | piece => $self->{board}[$x][$y] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 9 | $self->{move}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 9 | ▶ | $self->{turn} = $self->{turn} eq "b" ? "w" : "b"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 9 | ▶ | while (my ($key, $cb) = each %{ $self->{callbacks} }) { $cb->($key, $self) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 9 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | sub pass { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pass: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | push @{ $self->{moves} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | player => $self->{turn}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | piece => undef | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | $self->{move}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | ▶ | $self->{turn} = $self->{turn} eq "b" ? "w" : "b"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 447 | ▶ | my ($self, $pos) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 447 | my ($x, $y) = $self->_pos2grid($pos, $self->skip_i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 447 | $self->_check_grid($x, $y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 447 | return $self->{board}[$x][$y]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 996 | ▶ | sub size { $_[0]->{size} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | sub hoshi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 441 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hoshi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 441 | map { $self->_grid2pos(@$_, $self->skip_i) } @{ $self->{hoshi} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | sub is_hoshi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 437 | ▶ | my $board = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_hoshi: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 437 | my $point = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 437 | ▶ | return 1 if grep { /^$point$/ } $board->hoshi; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | sub as_sgf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_sgf: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | my $sgf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | $sgf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | .= "(;GM[$types{$self->{game}}]FF[4]AP[Games::Goban]SZ[$self->{size}]PB[$self->{black}]PW[$self->{white}]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | foreach (@{ $self->{moves} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | $sgf .= q{;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | . uc($_->{player}) . q<[> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 8 | ▶ | . ($_->{piece} ? $self->_grid2pos(@{ $_->{piece}->_xy }, 0) : q{}) . q<]>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | $sgf .= ")\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | return $sgf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | sub as_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | ▶ | my $board = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_text: called CC=15 SCAR=27.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | my @hoshi = $board->hoshi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 2 | my $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | ▶ | for (my $y = $board->size - 1; $y >= 0; $y--) { ## no critic For | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | $text .= substr($board->_grid2pos(0, $y, $board->skip_i), 1, 1) . ': ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 28 | ▶ | if $opts{coords}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 28 | for my $x (0 .. ($board->size - 1)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 442 | my $pos = $board->_grid2pos($x, $y, $board->skip_i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 442 | my $p = $board->get($pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 442 | ▶ | if ( $p | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$p and $p->move == $board->{"move"} - 1 and $text and substr($text, -1, 1) ne "\n"
$p and $p->move == $board->{"move"} - 1 and $text
$p and $p->move == $board->{"move"} - 1
MC/DC75%3/4
$p and $p->move == $board->{"move"} - 1 and $text and substr($text, -1, 1) ne "\n"
$p
$p->move == $board->{"move"} - 1
$text
substr($text, -1, 1) ne "\n"
Truth table80%4/5
A and B and C and D
A= $pB= $p->move == $board->{"move"} - 1C= $textD= substr($text, -1, 1) ne "\n"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | and $p->move == $board->{move} - 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | and $text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | and substr($text, -1, 1) ne "\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | chop $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | $text .= "("; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | $text .= ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 442 | ▶ | $p | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ? ($p->color eq "b" ? "X" : "O") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | : ($board->is_hoshi($pos) ? q{+} : q{.}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ) . q{ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 442 | ▶ | if ($p and $p->move == $board->{move} - 1) { chop $text; $text .= ")"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$p and $p->move == $board->{"move"} - 1
MC/DC100%2/2
$p and $p->move == $board->{"move"} - 1
$p
$p->move == $board->{"move"} - 1
Truth table100%3/3
A and B
A= $pB= $p->move == $board->{"move"} - 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 28 | $text .= "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | ▶ | if ($opts{coords}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $text .= q{ } x 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | for (0 .. ($board->size - 1)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $text .= substr($board->_grid2pos($_, 0, $board->skip_i), 0, 1) . q{ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $text .= "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | return $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | sub register { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | ▶ | my ($board, $cb) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | my $key = ++$board->{magiccookie}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | $board->{callbacks}{$key} = $cb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | $board->{notes}->{$key} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | return $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | sub notes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 4 | ▶ | my ($board, $key) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
notes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 4 | return $board->{notes}->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | sub hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | my $board = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my $hash = chr(0) x 91; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $bit = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | $board->_iterboard( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | my $piece = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | vec($hash, $bit, 2) = $piece->color eq "b" ? 1 : 2 if $piece; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $bit += 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | return $hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 4555 | ▶ | sub skip_i { return (shift)->{skip_i} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_i: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # This method accepts a position string and checks whether it is a valid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # position on the given board. If it is, 1 is returned. Otherwise, it carps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # that the position is not on the board. It does this by calling _check_grid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # also below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | sub _check_pos { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_pos: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 10 | my $pos = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 10 | my ($x, $y) = $self->_pos2grid($pos, $self->skip_i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 10 | return $self->_check_grid($x, $y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | sub _check_grid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 458 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_grid: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 458 | my ($x, $y) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 458 | ▶ | return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$x < $self->size and $y < $self->size
MC/DC50%1/2
$x < $self->size and $y < $self->size
$x < $self->size
$y < $self->size
Truth table66%2/3
A and B
A= $x < $self->sizeB= $y < $self->size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | if (($x < $self->size) and ($y < $self->size)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | croak "position '" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | . $self->_grid2pos($x, $y, $self->skip_i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | . "' not on board"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # This method returns a list of the hoshi points that should be found on the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # board, given its size. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | sub _calc_hoshi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 9 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_calc_hoshi: called CC=8 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 9 | my $size = $self->size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 9 | my $half = ($size - 1) / 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 9 | my @hoshi = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 9 | ▶ | if ($size % 2) { push @hoshi, [ $half, $half ]; } # middle center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 9 | ▶ | my $margin = ($size > 11 ? 4 : ($size > 6 ? 3 : ($size > 4 ? 2 : undef))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 9 | ▶ | return \@hoshi unless $margin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 9 | push @hoshi, ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | [ $margin - 1, $margin - 1 ], # top left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | [ $size - $margin, $margin - 1 ], # top right | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | [ $margin - 1, $size - $margin ], # bottom left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | [ $size - $margin, $size - $margin ] # bottom right | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 9 | ▶ | if (($size % 2) && ($size > 9)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$size % 2 and $size > 9
MC/DC50%1/2
$size % 2 and $size > 9
$size % 2
$size > 9
Truth table66%2/3
A and B
A= $size % 2B= $size > 9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 8 | push @hoshi, ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | [ $half, $margin - 1 ], # top center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | [ $margin - 1, $half ], # middle left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | [ $size - $margin, $half ], # middle right | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | [ $half, $size - $margin ] # bottom center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 9 | return \@hoshi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # This subroutine passes every findable square on the board to the supplied | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # subroutine reference. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | sub _iterboard { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | my ($self, $sub) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_iterboard: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | for my $x ('a' .. chr($self->size + ord("a") - 1)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | for my $y ('a' .. chr($self->size + ord("a") - 1)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $sub->($self->get("$x$y")); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # This method accepts an (x,y) position, starting with (0,0) and returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # 'xy' text representing it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # The third parameter, if true, indicates that 'i' should be skipped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | sub _grid2pos { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 8901 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_grid2pos: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 8901 | my ($x, $y, $skip_i) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 8901 | ▶ | if ($skip_i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 11 | for ($x, $y) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 22 | ▶ | $_++ if ($_ >= 8); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 8901 | return chr($ORIGIN + $x) . chr($ORIGIN + $y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # This method accepts an 'xy' position string and returns the (x,y) indexes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # where that position falls in the board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # The second parameter, if true, indicates that 'i' should be skipped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | sub _pos2grid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 3676 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pos2grid: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 3676 | my ($pos, $skip_i) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 3676 | my ($xc, $yc) = (lc($pos) =~ /^([a-z])([a-z])$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 3676 | my ($x, $y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 3676 | $x = ord($xc) - $ORIGIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 3676 | ▶ | $x-- if ($skip_i and ($x > 8)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$skip_i and $x > 8
MC/DC50%1/2
$skip_i and $x > 8
$skip_i
$x > 8
Truth table66%2/3
A and B
A= $skip_iB= $x > 8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 3676 | $y = ord($yc) - $ORIGIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 3676 | ▶ | $y-- if ($skip_i and ($y > 8)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$skip_i and $y > 8
MC/DC100%2/2
$skip_i and $y > 8
$skip_i
$y > 8
Truth table100%3/3
A and B
A= $skip_iB= $y > 8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 3676 | return ($x, $y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | package Games::Goban::Piece; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 6 | $Games::Goban::Piece::VERSION = '1.102'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 5 | ▶ | sub color { $_[0]->{colour} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
color: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub colour { $_[0]->{colour} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
colour: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | sub notes { $_[0]->{notes}->{ $_[1] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
notes: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | sub position { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | my $piece = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
position: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | ## no critic Private | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $piece->board->_grid2pos(@{ $piece->_xy }, $piece->board->skip_i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 6 | ▶ | sub _xy { $_[0]->{xy} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_xy: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 10 | ▶ | sub move { $_[0]->{move} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
move: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | sub board { $_[0]->{board} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
board: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||