| 1 | package Games::ABC_Path::Solver::Board; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 7 | $Games::ABC_Path::Solver::Board::VERSION = '0.6.2'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use parent 'Games::ABC_Path::Solver::Base'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use Games::ABC_Path::Solver::Constants; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use Games::ABC_Path::Solver::Move::LastRemainingCellForLetter; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Games::ABC_Path::Solver::Move::LastRemainingLetterForCell; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use Games::ABC_Path::Solver::Move::LettersNotInVicinity; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use Games::ABC_Path::Solver::Move::ResultsInAnError; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | ▶ | use Games::ABC_Path::Solver::Move::ResultsInASuccess; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | use Games::ABC_Path::Solver::Move::TryingLetterForCell; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 7 | ▶ | use Games::ABC_Path::Solver::Coord; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | my $ABCP_VERDICT_NO = 0; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | my $ABCP_VERDICT_MAYBE = 1; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 7 | my $ABCP_VERDICT_YES = 2; | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | my %letters_map = ( map { $letters[$_] => $_ } ( 0 .. $ABCP_MAX_LETTER ) ); | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | sub _get_letter_numeric | ||||||||||||||||||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 75 | ▶ | my ( $self, $letter_ascii ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_letter_numeric: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 75 | my $index = $letters_map{$letter_ascii}; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 75 | ▶ | if ( !defined($index) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | confess "Unknown letter '$letter_ascii'"; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 75 | return $index; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | sub _iter_changed | ||||||||||||||||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 584 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_iter_changed: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 584 | ▶ | if (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 296 | $self->{_iter_changed} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 584 | return $self->{_iter_changed}; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | sub _moves | ||||||||||||||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 284 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_moves: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 284 | ▶ | if (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 8 | $self->{_moves} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 284 | return $self->{_moves}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | sub _error | ||||||||||||||||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 40164 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 40164 | ▶ | if (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | $self->{_error} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 40164 | return $self->{_error}; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | sub _inc_changed | ||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 272 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inc_changed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 272 | $self->_iter_changed( $self->_iter_changed + 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 272 | return; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | sub _flush_changed | ||||||||||||||||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 16 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flush_changed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 16 | my $ret = $self->_iter_changed; | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 16 | $self->_iter_changed(0); | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 16 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | sub _add_move | ||||||||||||||||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 272 | ▶ | my ( $self, $move ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_move: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 272 | push @{ $self->_moves() }, $move; | |||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 272 | $self->_inc_changed; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 272 | return; | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | sub get_successful_layouts | ||||||||||||||||||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_successful_layouts: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 5 | return [ @{ $self->_successful_layouts } ]; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | sub _successful_layouts | ||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 18 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_successful_layouts: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 18 | ▶ | if (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 11 | $self->{_successful_layouts} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 18 | return $self->{_successful_layouts}; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | sub _layout | ||||||||||||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 43705 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_layout: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 43705 | ▶ | if (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 8 | $self->{_layout} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 43705 | return $self->{_layout}; | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | # The letter indexes. | ||||||||||||||||||||||||||||||||||||||||||
| 145 | sub _l_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 667 | ▶ | return ( 0 .. $ABCP_MAX_LETTER ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_l_indexes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | sub _init | ||||||||||||||||||||||||||||||||||||||||||
| 151 | { | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 8 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | my $layout_string = $args->{layout}; | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 8 | ▶ | if ( !defined($layout_string) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | $layout_string = ''; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 8 | $self->_layout( \$layout_string ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | 8 | $self->_successful_layouts( [] ); | |||||||||||||||||||||||||||||||||||||||||
| 163 | 8 | $self->_moves( [] ); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 8 | $self->_iter_changed(0); | |||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | sub _calc_offset | ||||||||||||||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 43692 | ▶ | my ( $self, $letter, $xy ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_calc_offset: called CC=3 SCAR=13.3
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 43692 | ▶ | if ( ( $letter < 0 ) or ( $letter >= 25 ) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$letter < 0 or $letter >= 25
MC/DC0%0/2
$letter < 0 or $letter >= 25
$letter < 0
$letter >= 25
Truth table33%1/3
A or B
A= $letter < 0B= $letter >= 25
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | confess "Letter $letter out of range."; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 43692 | return $letter * $BOARD_SIZE + $self->_xy_to_int( [ $xy->y, $xy->x ] ); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | sub _get_verdict | ||||||||||||||||||||||||||||||||||||||||||
| 182 | { | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 37882 | ▶ | my ( $self, $letter, $xy ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_verdict: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 37882 | return vec( ${ $self->_layout }, $self->_calc_offset( $letter, $xy, ), 2 ); | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | sub _set_verdict | ||||||||||||||||||||||||||||||||||||||||||
| 189 | { | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 5810 | ▶ | my ( $self, $letter, $xy, $verdict ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_verdict: called CC=5 SCAR=17.1
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | # Temporary - remove later. | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 5810 | ▶ | if ( @_ != 4 ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | confess "_set_verdict has wrong number of args."; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 5810 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$verdict == $ABCP_VERDICT_NO or $verdict == $ABCP_VERDICT_MAYBE or $verdict == $ABCP_VERDICT_YES
$verdict == $ABCP_VERDICT_NO or $verdict == $ABCP_VERDICT_MAYBE
MC/DC0%0/3
$verdict == $ABCP_VERDICT_NO or $verdict == $ABCP_VERDICT_MAYBE or $verdict == $ABCP_VERDICT_YES
$verdict == $ABCP_VERDICT_NO
$verdict == $ABCP_VERDICT_MAYBE
$verdict == $ABCP_VERDICT_YES
Truth table75%3/4
A or B or C
A= $verdict == $ABCP_VERDICT_NOB= $verdict == $ABCP_VERDICT_MAYBEC= $verdict == $ABCP_VERDICT_YES
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | not( ( $verdict == $ABCP_VERDICT_NO ) | ||||||||||||||||||||||||||||||||||||||||||
| 200 | || ( $verdict == $ABCP_VERDICT_MAYBE ) | ||||||||||||||||||||||||||||||||||||||||||
| 201 | || ( $verdict == $ABCP_VERDICT_YES ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 202 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 203 | { | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | confess "Invalid verdict $verdict ."; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 5810 | vec( ${ $self->_layout }, $self->_calc_offset( $letter, $xy ), 2 ) = | |||||||||||||||||||||||||||||||||||||||||
| 208 | $verdict; | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 5810 | return; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | sub _xy_loop | ||||||||||||||||||||||||||||||||||||||||||
| 214 | { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 1338 | ▶ | my ( $self, $sub_ref ) = (@_); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_xy_loop: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 1338 | foreach my $y ( $self->_y_indexes ) | |||||||||||||||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 6690 | ▶ | if ( $self->_error() ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | { | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 6690 | foreach my $x ( $self->_x_indexes ) | |||||||||||||||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 33449 | ▶ | if ( $self->_error() ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 33448 | $sub_ref->( | |||||||||||||||||||||||||||||||||||||||||
| 230 | Games::ABC_Path::Solver::Coord->new( { x => $x, y => $y } ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 1337 | return; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | sub _set_verdicts_for_letter_sets | ||||||||||||||||||||||||||||||||||||||||||
| 237 | { | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 36 | ▶ | my ( $self, $letter_list, $maybe_list ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_verdicts_for_letter_sets: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 36 | my %cell_is_maybe = ( map { $_->_to_s() => 1 } @$maybe_list ); | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 36 | foreach my $letter_ascii (@$letter_list) | |||||||||||||||||||||||||||||||||||||||||
| 243 | { | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 72 | my $letter = $self->_get_letter_numeric($letter_ascii); | |||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | $self->_xy_loop( | ||||||||||||||||||||||||||||||||||||||||||
| 247 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 1800 | ▶ | my ($xy) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | $self->_set_verdict( | ||||||||||||||||||||||||||||||||||||||||||
| 251 | $letter, $xy, | ||||||||||||||||||||||||||||||||||||||||||
| 252 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 1800 | ▶ | ( exists $cell_is_maybe{ $xy->_to_s() } ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | ? $ABCP_VERDICT_MAYBE | ||||||||||||||||||||||||||||||||||||||||||
| 255 | : $ABCP_VERDICT_NO | ||||||||||||||||||||||||||||||||||||||||||
| 256 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 257 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 72 | ); | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 36 | return; | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | sub _set_conclusive_verdict_for_letter | ||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 78 | ▶ | my ( $self, $letter, $l_xy ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_conclusive_verdict_for_letter: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | $self->_xy_loop( | ||||||||||||||||||||||||||||||||||||||||||
| 270 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 1950 | ▶ | my ($xy) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 1950 | ▶ | $self->_set_verdict( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | $letter, $xy, | ||||||||||||||||||||||||||||||||||||||||||
| 275 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 276 | $l_xy->_equal($xy) | ||||||||||||||||||||||||||||||||||||||||||
| 277 | ? $ABCP_VERDICT_YES | ||||||||||||||||||||||||||||||||||||||||||
| 278 | : $ABCP_VERDICT_NO | ||||||||||||||||||||||||||||||||||||||||||
| 279 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 280 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 78 | ); | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | OTHER_LETTER: | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 78 | foreach my $other_letter ( $self->_l_indexes ) | |||||||||||||||||||||||||||||||||||||||||
| 286 | { | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 1950 | ▶ | if ( $other_letter == $letter ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 78 | next OTHER_LETTER; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 1872 | $self->_set_verdict( $other_letter, $l_xy, $ABCP_VERDICT_NO ); | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 78 | return; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | sub _get_possible_letter_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 298 | { | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 573 | ▶ | my ( $self, $xy ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_possible_letter_indexes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 573 | return [ grep { $self->_get_verdict( $_, $xy ) != $ABCP_VERDICT_NO } | |||||||||||||||||||||||||||||||||||||||||
| 302 | $self->_l_indexes() ]; | ||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | sub get_possible_letters_for_cell | ||||||||||||||||||||||||||||||||||||||||||
| 307 | { | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 75 | ▶ | my ( $self, $x, $y ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_possible_letters_for_cell: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | return [ | ||||||||||||||||||||||||||||||||||||||||||
| 311 | @letters[ | ||||||||||||||||||||||||||||||||||||||||||
| 312 | @{ | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 75 | $self->_get_possible_letter_indexes( | |||||||||||||||||||||||||||||||||||||||||
| 314 | Games::ABC_Path::Solver::Coord->new( { x => $x, y => $y } ) | ||||||||||||||||||||||||||||||||||||||||||
| 315 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 318 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | sub _get_possible_letters_string | ||||||||||||||||||||||||||||||||||||||||||
| 322 | { | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 75 | ▶ | my ( $self, $xy ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_possible_letters_string: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | return | ||||||||||||||||||||||||||||||||||||||||||
| 326 | join( ',', | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 75 | @{ $self->get_possible_letters_for_cell( $xy->x, $xy->y ) } ); | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | sub _infer_letters | ||||||||||||||||||||||||||||||||||||||||||
| 331 | { | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 16 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_infer_letters: called CC=11 SCAR=24.1
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | 16 | foreach my $letter ( $self->_l_indexes ) | |||||||||||||||||||||||||||||||||||||||||
| 335 | { | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 400 | my @true_cells; | |||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | $self->_xy_loop( | ||||||||||||||||||||||||||||||||||||||||||
| 339 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 10000 | ▶ | my ($xy) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 10000 | my $ver = $self->_get_verdict( $letter, $xy ); | |||||||||||||||||||||||||||||||||||||||||
| 343 | 10000 | ▶ | if ( ( $ver == $ABCP_VERDICT_YES ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$ver == $ABCP_VERDICT_YES or $ver == $ABCP_VERDICT_MAYBE
MC/DC100%2/2
$ver == $ABCP_VERDICT_YES or $ver == $ABCP_VERDICT_MAYBE
$ver == $ABCP_VERDICT_YES
$ver == $ABCP_VERDICT_MAYBE
Truth table100%3/3
A or B
A= $ver == $ABCP_VERDICT_YESB= $ver == $ABCP_VERDICT_MAYBE
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | || ( $ver == $ABCP_VERDICT_MAYBE ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 345 | { | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 627 | push @true_cells, $xy; | |||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 400 | ); | |||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 400 | ▶ | if ( !@true_cells ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | { | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $self->_error( [ 'letter', $letter ] ); | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | elsif ( @true_cells == 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 357 | { | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 270 | my $xy = $true_cells[0]; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 270 | ▶ | if ( $self->_get_verdict( $letter, $xy ) == $ABCP_VERDICT_MAYBE ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | { | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 26 | $self->_set_conclusive_verdict_for_letter( $letter, $xy ); | |||||||||||||||||||||||||||||||||||||||||
| 362 | 26 | $self->_add_move( | |||||||||||||||||||||||||||||||||||||||||
| 363 | Games::ABC_Path::Solver::Move::LastRemainingCellForLetter | ||||||||||||||||||||||||||||||||||||||||||
| 364 | ->new( | ||||||||||||||||||||||||||||||||||||||||||
| 365 | { | ||||||||||||||||||||||||||||||||||||||||||
| 366 | vars => { | ||||||||||||||||||||||||||||||||||||||||||
| 367 | letter => $letter, | ||||||||||||||||||||||||||||||||||||||||||
| 368 | coords => $xy, | ||||||||||||||||||||||||||||||||||||||||||
| 369 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 372 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 400 | my @neighbourhood = ( map { [ (0) x $LEN ] } ( $self->_y_indexes ) ); | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 400 | foreach my $true (@true_cells) | |||||||||||||||||||||||||||||||||||||||||
| 379 | { | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 627 | foreach my $coords ( | |||||||||||||||||||||||||||||||||||||||||
| 381 | grep { | ||||||||||||||||||||||||||||||||||||||||||
| 382 | 5643 | ▶ | $self->_x_in_range( $_->[0] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | and $self->_y_in_range( $_->[1] ) | ||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 5643 | map { [ $true->x + $_->[0], $true->y + $_->[1] ] } | |||||||||||||||||||||||||||||||||||||||||
| 386 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 1881 | my $d = $_; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 1881 | map { [ $_, $d ] } ( -1 .. 1 ) | |||||||||||||||||||||||||||||||||||||||||
| 389 | } ( -1 .. 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 390 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 391 | { | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 4360 | $neighbourhood[ $coords->[1] ][ $coords->[0] ] = 1; | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 400 | ▶ | foreach my $neighbour_letter ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | ( ( $letter > 0 ) ? ( $letter - 1 ) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 398 | ( ( $letter < $ABCP_MAX_LETTER ) ? ( $letter + 1 ) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 399 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 400 | { | ||||||||||||||||||||||||||||||||||||||||||
| 401 | $self->_xy_loop( | ||||||||||||||||||||||||||||||||||||||||||
| 402 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 19200 | ▶ | my ($xy) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 19200 | ▶ | if ( $neighbourhood[ $xy->y ][ $xy->x ] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | { | ||||||||||||||||||||||||||||||||||||||||||
| 407 | 6228 | return; | |||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | 12972 | my $existing_verdict = | |||||||||||||||||||||||||||||||||||||||||
| 411 | $self->_get_verdict( $neighbour_letter, $xy ); | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 12972 | ▶ | if ( $existing_verdict == $ABCP_VERDICT_YES ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | { | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $self->_error( [ 'mismatched_verdict', $xy ] ); | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 12972 | ▶ | if ( $existing_verdict == $ABCP_VERDICT_MAYBE ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | { | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 188 | $self->_set_verdict( $neighbour_letter, $xy, | |||||||||||||||||||||||||||||||||||||||||
| 422 | $ABCP_VERDICT_NO ); | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 188 | $self->_add_move( | |||||||||||||||||||||||||||||||||||||||||
| 424 | Games::ABC_Path::Solver::Move::LettersNotInVicinity | ||||||||||||||||||||||||||||||||||||||||||
| 425 | ->new( | ||||||||||||||||||||||||||||||||||||||||||
| 426 | { | ||||||||||||||||||||||||||||||||||||||||||
| 427 | vars => { | ||||||||||||||||||||||||||||||||||||||||||
| 428 | target => $neighbour_letter, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | coords => $xy, | ||||||||||||||||||||||||||||||||||||||||||
| 430 | source => $letter, | ||||||||||||||||||||||||||||||||||||||||||
| 431 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 434 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | 768 | ); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 16 | return; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | sub _infer_cells | ||||||||||||||||||||||||||||||||||||||||||
| 445 | { | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 16 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_infer_cells: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | $self->_xy_loop( | ||||||||||||||||||||||||||||||||||||||||||
| 449 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 398 | ▶ | my ($xy) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 398 | my $letters_aref = $self->_get_possible_letter_indexes($xy); | |||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | 398 | ▶ | if ( !@$letters_aref ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | { | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 1 | $self->_error( [ 'cell', $xy ] ); | |||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | elsif ( @$letters_aref == 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 460 | { | ||||||||||||||||||||||||||||||||||||||||||
| 461 | 315 | my $letter = $letters_aref->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 315 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | $self->_get_verdict( $letter, $xy ) == $ABCP_VERDICT_MAYBE ) | ||||||||||||||||||||||||||||||||||||||||||
| 465 | { | ||||||||||||||||||||||||||||||||||||||||||
| 466 | 47 | $self->_set_conclusive_verdict_for_letter( $letter, $xy ); | |||||||||||||||||||||||||||||||||||||||||
| 467 | 47 | $self->_add_move( | |||||||||||||||||||||||||||||||||||||||||
| 468 | Games::ABC_Path::Solver::Move::LastRemainingLetterForCell | ||||||||||||||||||||||||||||||||||||||||||
| 469 | ->new( | ||||||||||||||||||||||||||||||||||||||||||
| 470 | { | ||||||||||||||||||||||||||||||||||||||||||
| 471 | vars => { | ||||||||||||||||||||||||||||||||||||||||||
| 472 | coords => $xy, | ||||||||||||||||||||||||||||||||||||||||||
| 473 | letter => $letter, | ||||||||||||||||||||||||||||||||||||||||||
| 474 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 475 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 476 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 477 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 16 | ); | |||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 16 | return; | |||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | sub _inference_iteration | ||||||||||||||||||||||||||||||||||||||||||
| 487 | { | ||||||||||||||||||||||||||||||||||||||||||
| 488 | 16 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inference_iteration: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 16 | $self->_infer_letters; | |||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 16 | $self->_infer_cells; | |||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 16 | return $self->_flush_changed; | |||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | sub _neighbourhood_and_individuality_inferring | ||||||||||||||||||||||||||||||||||||||||||
| 498 | { | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_neighbourhood_and_individuality_inferring: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 5 | my $num_changed = 0; | |||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 5 | ▶ | while ( my $iter_changed = $self->_inference_iteration() ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | { | ||||||||||||||||||||||||||||||||||||||||||
| 505 | 12 | ▶ | if ( $self->_error() ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | { | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | 11 | $num_changed += $iter_changed; | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 4 | return $num_changed; | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | sub _clone | ||||||||||||||||||||||||||||||||||||||||||
| 516 | { | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clone: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||
| 519 | return ref($self)->new( | ||||||||||||||||||||||||||||||||||||||||||
| 520 | { | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 5 | layout => ${ $self->_layout() }, | |||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||
| 523 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | sub solve | ||||||||||||||||||||||||||||||||||||||||||
| 528 | { | ||||||||||||||||||||||||||||||||||||||||||
| 529 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
solve: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 3 | my $error = $self->_solve_wrapper; | |||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | return [ | ||||||||||||||||||||||||||||||||||||||||||
| 534 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 3 | my $obj = $_; | |||||||||||||||||||||||||||||||||||||||||
| 536 | 3 | ▶ | ( blessed($obj) && $obj->isa('Games::ABC_Path::Solver::Coord') ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($obj) and $obj->isa("Games::ABC_Path::Solver::Coord")
MC/DC0%0/2
builtin::blessed($obj) and $obj->isa("Games::ABC_Path::Solver::Coord")
builtin::blessed($obj)
$obj->isa("Games::ABC_Path::Solver::Coord")
Truth table33%1/3
A and B
A= builtin::blessed($obj)B= $obj->isa("Games::ABC_Path::Solver::Coord")
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | ? ( $obj->x, $obj->y ) | ||||||||||||||||||||||||||||||||||||||||||
| 538 | : ($obj) | ||||||||||||||||||||||||||||||||||||||||||
| 539 | } @$error | ||||||||||||||||||||||||||||||||||||||||||
| 540 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | sub _solve_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 544 | { | ||||||||||||||||||||||||||||||||||||||||||
| 545 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_solve_wrapper: called CC=9 SCAR=22.3
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 5 | $self->_neighbourhood_and_individuality_inferring; | |||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 5 | ▶ | if ( $self->_error ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 550 | { | ||||||||||||||||||||||||||||||||||||||||||
| 551 | 1 | return $self->_error; | |||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 4 | my @min_coords; | |||||||||||||||||||||||||||||||||||||||||
| 555 | my @min_options; | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | $self->_xy_loop( | ||||||||||||||||||||||||||||||||||||||||||
| 558 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 559 | 100 | ▶ | my ($xy) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | 100 | my $letters_aref = $self->_get_possible_letter_indexes($xy); | |||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 100 | ▶ | if ( !@$letters_aref ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | { | ||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $self->_error( [ 'cell', $xy ] ); | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | elsif ( @$letters_aref > 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 568 | { | ||||||||||||||||||||||||||||||||||||||||||
| 569 | 4 | ▶ | if ( ( !@min_coords ) or ( @$letters_aref < @min_options ) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @min_coords or @$letters_aref < @min_options
MC/DC50%1/2
not @min_coords or @$letters_aref < @min_options
not @min_coords
@$letters_aref < @min_options
Truth table66%2/3
not(A) or B
A= not @min_coordsB= @$letters_aref < @min_options
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | { | ||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | @min_options = @$letters_aref; | |||||||||||||||||||||||||||||||||||||||||
| 572 | 1 | @min_coords = ($xy); | |||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 100 | return; | |||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||
| 578 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | 4 | ▶ | if ( $self->_error ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 581 | { | ||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | return $self->_error; | |||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | 4 | ▶ | if (@min_coords) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 586 | { | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 1 | my ($xy) = @min_coords; | |||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | # We have at least one multiple rank cell. Let's recurse there: | ||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | foreach my $letter (@min_options) | |||||||||||||||||||||||||||||||||||||||||
| 591 | { | ||||||||||||||||||||||||||||||||||||||||||
| 592 | 2 | my $recurse_solver = $self->_clone; | |||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | 2 | $self->_add_move( | |||||||||||||||||||||||||||||||||||||||||
| 595 | Games::ABC_Path::Solver::Move::TryingLetterForCell->new( | ||||||||||||||||||||||||||||||||||||||||||
| 596 | { | ||||||||||||||||||||||||||||||||||||||||||
| 597 | vars => { letter => $letter, coords => $xy, }, | ||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||
| 599 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 600 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | 2 | $recurse_solver->_set_conclusive_verdict_for_letter( $letter, $xy ); | |||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | 2 | $recurse_solver->_solve_wrapper; | |||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 2 | foreach my $move ( @{ $recurse_solver->get_moves } ) | |||||||||||||||||||||||||||||||||||||||||
| 607 | { | ||||||||||||||||||||||||||||||||||||||||||
| 608 | 7 | $self->_add_move( $move->bump() ); | |||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||
| 611 | 2 | ▶ | if ( $recurse_solver->_error() ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 612 | { | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 1 | $self->_add_move( | |||||||||||||||||||||||||||||||||||||||||
| 614 | Games::ABC_Path::Solver::Move::ResultsInAnError->new( | ||||||||||||||||||||||||||||||||||||||||||
| 615 | { | ||||||||||||||||||||||||||||||||||||||||||
| 616 | vars => { | ||||||||||||||||||||||||||||||||||||||||||
| 617 | letter => $letter, | ||||||||||||||||||||||||||||||||||||||||||
| 618 | coords => $xy, | ||||||||||||||||||||||||||||||||||||||||||
| 619 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 622 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | else | ||||||||||||||||||||||||||||||||||||||||||
| 625 | { | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 1 | $self->_add_move( | |||||||||||||||||||||||||||||||||||||||||
| 627 | Games::ABC_Path::Solver::Move::ResultsInASuccess->new( | ||||||||||||||||||||||||||||||||||||||||||
| 628 | { | ||||||||||||||||||||||||||||||||||||||||||
| 629 | vars => { letter => $letter, coords => $xy, }, | ||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 632 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 1 | push @{ $self->_successful_layouts }, | |||||||||||||||||||||||||||||||||||||||||
| 634 | 1 | @{ $recurse_solver->get_successful_layouts() }; | |||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 1 | my $count = @{ $self->_successful_layouts() }; | |||||||||||||||||||||||||||||||||||||||||
| 639 | 1 | ▶ | if ( !$count ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | { | ||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | return ['all_options_bad']; | |||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | elsif ( $count == 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 644 | { | ||||||||||||||||||||||||||||||||||||||||||
| 645 | 1 | return ['success']; | |||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||
| 647 | else | ||||||||||||||||||||||||||||||||||||||||||
| 648 | { | ||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | return ['success_multiple']; | |||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 652 | else | ||||||||||||||||||||||||||||||||||||||||||
| 653 | { | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 3 | $self->_successful_layouts( [ $self->_clone() ] ); | |||||||||||||||||||||||||||||||||||||||||
| 655 | 3 | return ['success']; | |||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | 7 | my $letter_re_s = join( '', map { quotemeta($_) } @letters ); | |||||||||||||||||||||||||||||||||||||||||
| 660 | 7 | my $letter_re = qr{[$letter_re_s]}; | |||||||||||||||||||||||||||||||||||||||||
| 661 | 7 | my $letter_and_space_re = qr{[ $letter_re_s]}; | |||||||||||||||||||||||||||||||||||||||||
| 662 | 7 | my $top_bottom_re = qr/^${letter_re}{7}\n/ms; | |||||||||||||||||||||||||||||||||||||||||
| 663 | 7 | my $inner_re = qr/^${letter_re}${letter_and_space_re}{5}${letter_re}\n/ms; | |||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | sub _assert_letters_appear_once | ||||||||||||||||||||||||||||||||||||||||||
| 666 | { | ||||||||||||||||||||||||||||||||||||||||||
| 667 | 3 | ▶ | my ( $self, $layout_string ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_assert_letters_appear_once: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | 3 | my %count_letters = ( map { $_ => 0 } @letters ); | |||||||||||||||||||||||||||||||||||||||||
| 670 | 3 | foreach my $letter ( $layout_string =~ m{($letter_re)}g ) | |||||||||||||||||||||||||||||||||||||||||
| 671 | { | ||||||||||||||||||||||||||||||||||||||||||
| 672 | 75 | ▶ | if ( $count_letters{$letter}++ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | { | ||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | confess "Letter '$letter' encountered twice in the layout."; | |||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | sub _process_major_diagonal | ||||||||||||||||||||||||||||||||||||||||||
| 682 | { | ||||||||||||||||||||||||||||||||||||||||||
| 683 | 3 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_major_diagonal: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 3 | my @major_diagonal_letters; | |||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 3 | $args->{top} =~ m{\A($letter_re)}; | |||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | 3 | push @major_diagonal_letters, $1; | |||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | 3 | $args->{bottom} =~ m{($letter_re)\z}; | |||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | 3 | push @major_diagonal_letters, $1; | |||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | $self->_set_verdicts_for_letter_sets( | ||||||||||||||||||||||||||||||||||||||||||
| 696 | \@major_diagonal_letters, | ||||||||||||||||||||||||||||||||||||||||||
| 697 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 698 | 3 | map { Games::ABC_Path::Solver::Coord->new( { x => $_, y => $_ } ) } | |||||||||||||||||||||||||||||||||||||||||
| 699 | $self->_y_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 700 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 701 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | sub _process_minor_diagonal | ||||||||||||||||||||||||||||||||||||||||||
| 707 | { | ||||||||||||||||||||||||||||||||||||||||||
| 708 | 3 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_minor_diagonal: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | 3 | my @minor_diagonal_letters; | |||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||
| 712 | 3 | $args->{top} =~ m{($letter_re)\z}; | |||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | 3 | push @minor_diagonal_letters, $1; | |||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | 3 | $args->{bottom} =~ m{\A($letter_re)}; | |||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | 3 | push @minor_diagonal_letters, $1; | |||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | $self->_set_verdicts_for_letter_sets( | ||||||||||||||||||||||||||||||||||||||||||
| 721 | \@minor_diagonal_letters, | ||||||||||||||||||||||||||||||||||||||||||
| 722 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 723 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 724 | 3 | Games::ABC_Path::Solver::Coord->new( { x => $_, y => 4 - $_ } ) | |||||||||||||||||||||||||||||||||||||||||
| 725 | } ( $self->_y_indexes ) | ||||||||||||||||||||||||||||||||||||||||||
| 726 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 727 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||
| 732 | sub _process_input_columns | ||||||||||||||||||||||||||||||||||||||||||
| 733 | { | ||||||||||||||||||||||||||||||||||||||||||
| 734 | 3 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_input_columns: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | 3 | my $top_row = $args->{top}; | |||||||||||||||||||||||||||||||||||||||||
| 737 | 3 | my $bottom_row = $args->{bottom}; | |||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | 3 | foreach my $x ( $self->_x_indexes ) | |||||||||||||||||||||||||||||||||||||||||
| 740 | { | ||||||||||||||||||||||||||||||||||||||||||
| 741 | $self->_set_verdicts_for_letter_sets( | ||||||||||||||||||||||||||||||||||||||||||
| 742 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 743 | substr( $top_row, $x + 1, 1 ), substr( $bottom_row, $x + 1, 1 ), | ||||||||||||||||||||||||||||||||||||||||||
| 744 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 745 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 746 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 747 | 15 | Games::ABC_Path::Solver::Coord->new( { x => $x, y => $_ } ) | |||||||||||||||||||||||||||||||||||||||||
| 748 | } $self->_y_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 749 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 750 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | sub _process_input_rows_and_initial_letter_clue | ||||||||||||||||||||||||||||||||||||||||||
| 757 | { | ||||||||||||||||||||||||||||||||||||||||||
| 758 | 3 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_process_input_rows_and_initial_letter_clue: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | 3 | my $rows = $args->{rows}; | |||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | 3 | my ( $clue_x, $clue_y, $clue_letter ); | |||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | 3 | foreach my $y ( $self->_y_indexes ) | |||||||||||||||||||||||||||||||||||||||||
| 765 | { | ||||||||||||||||||||||||||||||||||||||||||
| 766 | 15 | my $row = $rows->[$y]; | |||||||||||||||||||||||||||||||||||||||||
| 767 | $self->_set_verdicts_for_letter_sets( | ||||||||||||||||||||||||||||||||||||||||||
| 768 | [ substr( $row, 0, 1 ), substr( $row, -1 ), ], | ||||||||||||||||||||||||||||||||||||||||||
| 769 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 770 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 771 | 15 | Games::ABC_Path::Solver::Coord->new( { x => $_, y => $y } ) | |||||||||||||||||||||||||||||||||||||||||
| 772 | } $self->_x_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 773 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 774 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||
| 776 | 15 | my $s = substr( $row, 1, -1 ); | |||||||||||||||||||||||||||||||||||||||||
| 777 | 15 | ▶ | if ( $s =~ m{($letter_re)}g ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 778 | { | ||||||||||||||||||||||||||||||||||||||||||
| 779 | 3 | my ( $l, $x_plus_1 ) = ( $1, pos($s) ); | |||||||||||||||||||||||||||||||||||||||||
| 780 | 3 | ▶ | if ( defined($clue_letter) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 781 | { | ||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | confess "Found more than one clue letter in the layout!"; | |||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||
| 784 | 3 | ( $clue_x, $clue_y, $clue_letter ) = ( $x_plus_1 - 1, $y, $l ); | |||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||
| 788 | 3 | ▶ | if ( !defined($clue_letter) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | { | ||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | confess "Did not find any clue letters inside the layout."; | |||||||||||||||||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||
| 793 | $self->_set_conclusive_verdict_for_letter( | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 3 | $self->_get_letter_numeric($clue_letter), | |||||||||||||||||||||||||||||||||||||||||
| 795 | Games::ABC_Path::Solver::Coord->new( { x => $clue_x, y => $clue_y } ), | ||||||||||||||||||||||||||||||||||||||||||
| 796 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | sub _input | ||||||||||||||||||||||||||||||||||||||||||
| 802 | { | ||||||||||||||||||||||||||||||||||||||||||
| 803 | 3 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_input: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||
| 805 | 3 | ▶ | if ( $args->{version} ne 1 ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | { | ||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | die "Can only handle version 1"; | |||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||
| 810 | 3 | my $layout_string = $args->{layout}; | |||||||||||||||||||||||||||||||||||||||||
| 811 | 3 | ▶ | if ( $layout_string !~ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 812 | m/\A${top_bottom_re}${inner_re}{5}${top_bottom_re}\z/ms ) | ||||||||||||||||||||||||||||||||||||||||||
| 813 | { | ||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | die | |||||||||||||||||||||||||||||||||||||||||
| 815 | "Invalid format. Should be Letter{7}\n(Letter{spaces or one letter}{5}Letter){5}\nLetter{7}"; | ||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | 3 | my @rows = split( /\n/, $layout_string ); | |||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | 3 | my $top_row = shift(@rows); | |||||||||||||||||||||||||||||||||||||||||
| 821 | 3 | my $bottom_row = pop(@rows); | |||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||
| 823 | # Now let's process the layout string and populate the verdicts table. | ||||||||||||||||||||||||||||||||||||||||||
| 824 | 3 | $self->_assert_letters_appear_once($layout_string); | |||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | 3 | my $parse_context = | |||||||||||||||||||||||||||||||||||||||||
| 827 | { top => $top_row, bottom => $bottom_row, rows => \@rows, }; | ||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||
| 829 | 3 | $self->_process_major_diagonal($parse_context); | |||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||
| 831 | 3 | $self->_process_minor_diagonal($parse_context); | |||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||
| 833 | 3 | $self->_process_input_columns($parse_context); | |||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||
| 835 | 3 | $self->_process_input_rows_and_initial_letter_clue($parse_context); | |||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||
| 840 | sub _get_results_text_table | ||||||||||||||||||||||||||||||||||||||||||
| 841 | { | ||||||||||||||||||||||||||||||||||||||||||
| 842 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_results_text_table: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | my $render_row = sub { | ||||||||||||||||||||||||||||||||||||||||||
| 845 | 18 | ▶ | my $cols = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | return | ||||||||||||||||||||||||||||||||||||||||||
| 848 | "| " | ||||||||||||||||||||||||||||||||||||||||||
| 849 | 18 | ▶ | . join( " | ", map { length($_) == 1 ? " $_ " : $_ } @$cols ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 850 | . " |\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 851 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||
| 853 | return join( | ||||||||||||||||||||||||||||||||||||||||||
| 854 | '', | ||||||||||||||||||||||||||||||||||||||||||
| 855 | 18 | map { $render_row->($_) } ( | |||||||||||||||||||||||||||||||||||||||||
| 856 | 15 | [ map { sprintf( "X = %d", $_ + 1 ) } $self->_x_indexes ], | |||||||||||||||||||||||||||||||||||||||||
| 857 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 858 | 3 | my $y = $_; | |||||||||||||||||||||||||||||||||||||||||
| 859 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 860 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 861 | 15 | $self->_get_possible_letters_string( | |||||||||||||||||||||||||||||||||||||||||
| 862 | Games::ABC_Path::Solver::Coord->new( | ||||||||||||||||||||||||||||||||||||||||||
| 863 | { x => $_, y => $y } | ||||||||||||||||||||||||||||||||||||||||||
| 864 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 865 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 866 | } $self->_x_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 867 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 868 | } $self->_y_indexes | ||||||||||||||||||||||||||||||||||||||||||
| 869 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 870 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||
| 874 | sub get_successes_text_tables | ||||||||||||||||||||||||||||||||||||||||||
| 875 | { | ||||||||||||||||||||||||||||||||||||||||||
| 876 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_successes_text_tables: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||
| 878 | 3 | return [ map { $_->_get_results_text_table() } | |||||||||||||||||||||||||||||||||||||||||
| 879 | 3 | @{ $self->get_successful_layouts() } ]; | |||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | sub input_from_file | ||||||||||||||||||||||||||||||||||||||||||
| 884 | { | ||||||||||||||||||||||||||||||||||||||||||
| 885 | 2 | ▶ | my ( $class, $board_fn ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
input_from_file: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | 2 | ▶ | open my $in_fh, "<", $board_fn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 888 | or die "Cannot open '$board_fn' - $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | 2 | my $first_line = <$in_fh>; | |||||||||||||||||||||||||||||||||||||||||
| 891 | 2 | chomp($first_line); | |||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | 2 | my $magic = 'ABC Path Solver Layout Version 1:'; | |||||||||||||||||||||||||||||||||||||||||
| 894 | 2 | ▶ | if ( $first_line !~ m{\A\Q$magic\E\s*\z} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 895 | { | ||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | die "Can only process files whose first line is '$magic'!"; | |||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | 2 | my $layout_string = ''; | |||||||||||||||||||||||||||||||||||||||||
| 900 | 2 | foreach my $line_idx ( 1 .. 7 ) | |||||||||||||||||||||||||||||||||||||||||
| 901 | { | ||||||||||||||||||||||||||||||||||||||||||
| 902 | 14 | chomp( my $line = <$in_fh> ); | |||||||||||||||||||||||||||||||||||||||||
| 903 | 14 | $layout_string .= "$line\n"; | |||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||
| 905 | 2 | close($in_fh); | |||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | 2 | return $class->input_from_v1_string($layout_string); | |||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | sub input_from_v1_string | ||||||||||||||||||||||||||||||||||||||||||
| 912 | { | ||||||||||||||||||||||||||||||||||||||||||
| 913 | 3 | ▶ | my ( $class, $layout_string ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
input_from_v1_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||
| 915 | 3 | my $self = $class->new; | |||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||
| 917 | 3 | $self->_input( { layout => $layout_string, version => 1 } ); | |||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||
| 919 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | sub get_moves | ||||||||||||||||||||||||||||||||||||||||||
| 924 | { | ||||||||||||||||||||||||||||||||||||||||||
| 925 | 4 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_moves: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | 4 | return [ @{ $self->_moves } ]; | |||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | 7 | 1; # End of Games::ABC_Path::Solver::Board | |||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | __END__ | ||||||||||||||||||||||||||||||||||||||||||