line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Time-stamp: "1999-03-03 20:02:20 MST" -*-Perl-*- |
2
|
|
|
|
|
|
|
package Games::Worms::Random; |
3
|
1
|
|
|
1
|
|
9406
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
378
|
|
4
|
1
|
|
|
1
|
|
6
|
use vars qw($Debug $VERSION @ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
5
|
1
|
|
|
1
|
|
6
|
use Games::Worms::Base; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
129
|
|
6
|
|
|
|
|
|
|
@ISA = ('Games::Worms::Base'); |
7
|
|
|
|
|
|
|
$Debug = 0; |
8
|
|
|
|
|
|
|
$VERSION = "0.60"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Games::Worms::Random -- random worms |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
perl -MGames::Worms -e worms -- -tTk Games::Worms::Random |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Worms in the class Games::Worms::Random are totally random -- they |
22
|
|
|
|
|
|
|
move at random in whichever way they can, without regard to any rules |
23
|
|
|
|
|
|
|
or past movement. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub which_way { # figure out which direction to go in |
29
|
0
|
|
|
0
|
0
|
|
my($worm, $hash_r) = @_; |
30
|
0
|
|
|
|
|
|
my @dirs = keys %$hash_r; |
31
|
0
|
|
|
|
|
|
return $dirs[ rand(@dirs) ]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
0
|
|
sub am_memoized { 0; } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |