line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Language::Homespring::Snowmelt; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 0.01; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
110
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
134
|
|
6
|
4
|
|
|
4
|
|
24
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1367
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
31
|
|
|
31
|
0
|
43
|
my $class = shift; |
10
|
31
|
|
|
|
|
101
|
my $self = bless {}, $class; |
11
|
|
|
|
|
|
|
|
12
|
31
|
|
|
|
|
39
|
my $options = shift; |
13
|
31
|
|
|
|
|
81
|
$self->{interp} = $options->{interp}; |
14
|
31
|
|
|
|
|
49
|
$self->{time_at_node} = 0; |
15
|
31
|
|
|
|
|
48
|
$self->{location} = $options->{location}; |
16
|
|
|
|
|
|
|
|
17
|
31
|
|
|
|
|
92
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub move { |
21
|
114
|
|
|
114
|
0
|
156
|
my ($self) = @_; |
22
|
|
|
|
|
|
|
|
23
|
114
|
|
|
|
|
130
|
$self->{time_at_node}++; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# see if we can leave the current node |
26
|
|
|
|
|
|
|
|
27
|
114
|
100
|
100
|
|
|
510
|
return if (($self->{location}->{node_name} eq 'marshy') && ($self->{time_at_node} == 1)); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# see if we can enter the next one |
30
|
|
|
|
|
|
|
|
31
|
86
|
|
|
|
|
127
|
my $dest = $self->{location}->{parent_node}; |
32
|
|
|
|
|
|
|
|
33
|
86
|
100
|
|
|
|
3061
|
if (defined($dest)){ |
34
|
81
|
|
|
|
|
126
|
$self->{location} = $dest; |
35
|
81
|
|
|
|
|
100
|
$self->{time_at_node} = 0; |
36
|
81
|
|
|
|
|
148
|
$self->smash(); |
37
|
|
|
|
|
|
|
}else{ |
38
|
|
|
|
|
|
|
# if there's nowhere to go, |
39
|
5
|
|
|
|
|
13
|
$self->kill(); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub kill { |
45
|
5
|
|
|
5
|
0
|
7
|
my ($self) = @_; |
46
|
5
|
|
|
|
|
60
|
@{$self->{interp}->{snowmelt}} = grep{ |
|
32
|
|
|
|
|
84
|
|
47
|
5
|
|
|
|
|
17
|
$_ ne $self |
48
|
5
|
|
|
|
|
5
|
}@{$self->{interp}->{snowmelt}}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub smash { |
52
|
81
|
|
|
81
|
0
|
86
|
my ($self) = @_; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# smash stuff at the current node |
55
|
81
|
|
|
|
|
129
|
my $node_name = $self->{location}->{node_name}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#print "Smashing up a $node_name...\n"; |
58
|
|
|
|
|
|
|
|
59
|
81
|
|
|
|
|
104
|
$self->{location}->{destroyed} = 1; |
60
|
|
|
|
|
|
|
|
61
|
81
|
100
|
|
|
|
452
|
if ($node_name eq 'universe'){ |
62
|
2
|
|
|
|
|
41
|
$self->{interp}->{universe_ok} = 0; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|