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