line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Game::TextPacMonster::V; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
762
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
114
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
107
|
|
5
|
4
|
|
|
4
|
|
23
|
use utf8; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
29
|
|
6
|
4
|
|
|
4
|
|
550
|
use Game::TextPacMonster::Point; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
118
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
23
|
use base 'Game::TextPacMonster::Creature'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1534
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
24
|
|
|
24
|
0
|
89
|
my $class = shift @_; |
12
|
24
|
|
|
|
|
120
|
my $self = $class->SUPER::new(@_); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub move_free { |
17
|
10
|
|
|
10
|
0
|
42
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
10
|
|
|
|
|
34
|
my $relative_p = $self->get_relative_point; |
20
|
10
|
|
|
|
|
34
|
my $relative_x = $relative_p->x_coord; |
21
|
10
|
|
|
|
|
29
|
my $relative_y = $relative_p->y_coord; |
22
|
|
|
|
|
|
|
|
23
|
10
|
|
|
|
|
31
|
my @moves = qw( move_down move_left move_up move_right); |
24
|
|
|
|
|
|
|
|
25
|
10
|
|
|
|
|
15
|
my $first_move = undef; |
26
|
|
|
|
|
|
|
|
27
|
10
|
100
|
|
|
|
40
|
if ( $relative_y != 0 ) { |
|
|
100
|
|
|
|
|
|
28
|
2
|
100
|
|
|
|
10
|
$first_move = ( $relative_y > 0 ) ? 'move_down' : 'move_up'; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ( $relative_x != 0 ) { |
31
|
7
|
100
|
|
|
|
20
|
$first_move = ( $relative_x > 0 ) ? 'move_right' : 'move_left'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
10
|
100
|
|
|
|
32
|
unshift( @moves, $first_move ) if $first_move; |
35
|
|
|
|
|
|
|
|
36
|
10
|
|
|
|
|
18
|
for my $move (@moves) { |
37
|
24
|
100
|
|
|
|
105
|
return 1 if $self->$move; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
10
|
return 0; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |