line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::ABC_Path::Generator::FinalLayoutObj; |
2
|
|
|
|
|
|
|
$Games::ABC_Path::Generator::FinalLayoutObj::VERSION = '0.6.0'; |
3
|
2
|
|
|
2
|
|
37
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
40
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
66
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use integer; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
58
|
use parent 'Games::ABC_Path::Generator::Base'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
264
|
use Games::ABC_Path::Solver::Constants; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1194
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _s |
16
|
|
|
|
|
|
|
{ |
17
|
31
|
|
|
31
|
|
45
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
31
|
100
|
|
|
|
67
|
if (@_) |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
|
|
7
|
$self->{_s} = shift; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
31
|
|
|
|
|
129
|
return $self->{_s}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _init |
28
|
|
|
|
|
|
|
{ |
29
|
1
|
|
|
1
|
|
9
|
my $self = shift; |
30
|
1
|
|
|
|
|
3
|
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
|
298
|
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
|
|
|
|
|
5
|
my ( $y, $x ) = $self->_to_xy( $self->get_A_pos() ); |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
14
|
return { y => $y, x => $x, }; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub get_cell_contents |
57
|
|
|
|
|
|
|
{ |
58
|
27
|
|
|
27
|
1
|
59
|
my ( $self, $index ) = @_; |
59
|
|
|
|
|
|
|
|
60
|
27
|
|
|
|
|
46
|
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
|
|
|
|
|
17
|
$self->_xy_to_int( [ $pos->{'y'}, $pos->{'x'} ], ) |
71
|
|
|
|
|
|
|
) - 1, |
72
|
|
|
|
|
|
|
]; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub as_string |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
1
|
|
my ( $l, $args ) = @_; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $render_row = sub { |
81
|
0
|
|
|
0
|
|
|
my $y = shift; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
return join( |
84
|
|
|
|
|
|
|
" | ", |
85
|
|
|
|
|
|
|
map { |
86
|
0
|
|
|
|
|
|
my $x = $_; |
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $v = $l->get_cell_contents( $l->_xy_to_int( [ $y, $x ] ) ); |
88
|
0
|
0
|
|
|
|
|
$v ? $letters[ $v - 1 ] : '*' |
89
|
|
|
|
|
|
|
} ( 0 .. $LEN - 1 ) |
90
|
|
|
|
|
|
|
); |
91
|
0
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
return join( '', map { $render_row->($_) . "\n" } ( 0 .. $LEN - 1 ) ); |
|
0
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; # End of Games::ABC_Path::Generator |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |