line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::ABC_Path::Generator::FinalLayoutObj; |
2
|
|
|
|
|
|
|
$Games::ABC_Path::Generator::FinalLayoutObj::VERSION = '0.4.3'; |
3
|
2
|
|
|
2
|
|
36
|
use 5.006; |
|
2
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
42
|
|
6
|
2
|
|
|
2
|
|
19
|
use warnings; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
81
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use integer; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
77
|
use parent 'Games::ABC_Path::Generator::Base'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
10
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
120
|
use Games::ABC_Path::Solver::Constants; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1135
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _s |
16
|
|
|
|
|
|
|
{ |
17
|
31
|
|
|
31
|
|
54
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
31
|
100
|
|
|
|
63
|
if (@_) |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
|
|
6
|
$self->{_s} = shift; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
31
|
|
|
|
|
117
|
return $self->{_s}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _init |
28
|
|
|
|
|
|
|
{ |
29
|
1
|
|
|
1
|
|
9
|
my $self = shift; |
30
|
1
|
|
|
|
|
2
|
my $args = shift; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
4
|
$self->_s( $args->{layout_string} ); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
2
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub get_A_pos |
39
|
|
|
|
|
|
|
{ |
40
|
3
|
|
|
3
|
1
|
303
|
my ($self) = @_; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
9
|
return index( $self->_s, chr(1) ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub get_A_xy |
47
|
|
|
|
|
|
|
{ |
48
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
4
|
my ( $y, $x ) = $self->_to_xy( $self->get_A_pos() ); |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
22
|
return { y => $y, x => $x, }; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub get_cell_contents |
57
|
|
|
|
|
|
|
{ |
58
|
27
|
|
|
27
|
1
|
64
|
my ( $self, $index ) = @_; |
59
|
|
|
|
|
|
|
|
60
|
27
|
|
|
|
|
41
|
return vec( $self->_s, $index, 8 ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_letter_at_pos |
65
|
|
|
|
|
|
|
{ |
66
|
3
|
|
|
3
|
1
|
8
|
my ( $self, $pos ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
return $letters[ |
69
|
|
|
|
|
|
|
$self->get_cell_contents( |
70
|
3
|
|
|
|
|
19
|
$self->_xy_to_int( [ $pos->{'y'}, $pos->{'x'} ], ) ) - 1, |
71
|
|
|
|
|
|
|
]; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub as_string |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
1
|
|
my ( $l, $args ) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $render_row = sub { |
80
|
0
|
|
|
0
|
|
|
my $y = shift; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
return join( |
83
|
|
|
|
|
|
|
" | ", |
84
|
|
|
|
|
|
|
map { |
85
|
0
|
|
|
|
|
|
my $x = $_; |
|
0
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $v = $l->get_cell_contents( $l->_xy_to_int( [ $y, $x ] ) ); |
87
|
0
|
0
|
|
|
|
|
$v ? $letters[ $v - 1 ] : '*' |
88
|
|
|
|
|
|
|
} ( 0 .. $LEN - 1 ) |
89
|
|
|
|
|
|
|
); |
90
|
0
|
|
|
|
|
|
}; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return join( '', map { $render_row->($_) . "\n" } ( 0 .. $LEN - 1 ) ); |
|
0
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; # End of Games::ABC_Path::Generator |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |