File Coverage

blib/lib/Games/ABC_Path/Solver/Base.pm
Criterion Covered Total %
statement 24 26 92.3
branch n/a
condition 3 3 100.0
subroutine 10 11 90.9
pod 1 1 100.0
total 38 41 92.6


line stmt bran cond sub pod time code
1             package Games::ABC_Path::Solver::Base;
2             $Games::ABC_Path::Solver::Base::VERSION = '0.8.1';
3 16     16   319942 use warnings;
  16         39  
  16         980  
4 16     16   95 use strict;
  16         27  
  16         411  
5              
6 16     16   7996 use Games::ABC_Path::Solver::Constants;
  16         46  
  16         3975  
7              
8              
9             sub new
10             {
11 34064     34064 1 54421 my $class = shift;
12              
13 34064         58646 my $self = bless {}, $class;
14              
15 34064         91345 $self->_init(@_);
16              
17 34064         75130 return $self;
18             }
19              
20 16     16   8053 use integer;
  16         268  
  16         88  
21              
22             sub _xy_to_int
23             {
24 43692     43692   74356 my ( $self, $xy ) = @_;
25              
26              
27 43692         152747 return $xy->[$Y] * $LEN + $xy->[$X];
28             }
29              
30             sub _to_xy
31             {
32 0     0   0 my ( $self, $int ) = @_;
33              
34 0         0 return ( ( $int / $LEN ), ( $int % $LEN ) );
35             }
36              
37             sub _y_indexes
38             {
39 1765     1765   5225 return ( 0 .. $LEN_LIM );
40             }
41              
42             sub _x_indexes
43             {
44 6726     6726   16153 return ( 0 .. $LEN_LIM );
45             }
46              
47             sub _x_in_range
48             {
49 10632     10632   16909 my ( $self, $x ) = @_;
50              
51 10632   100     38803 return ( $x >= 0 and $x < $LEN );
52             }
53              
54             sub _y_in_range
55             {
56 4989     4989   7505 my ( $self, $y ) = @_;
57              
58 4989         8117 return $self->_x_in_range($y);
59             }
60              
61              
62             1; # End of Games::ABC_Path::Solver::Base
63              
64             __END__