line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Time-stamp: "1999-03-03 20:11:21 MST" -*-Perl-*- |
2
|
|
|
|
|
|
|
package Games::Worms::Random2; |
3
|
1
|
|
|
1
|
|
9215
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
68
|
|
4
|
1
|
|
|
1
|
|
5
|
use vars qw($Debug $VERSION @ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
76
|
|
5
|
1
|
|
|
1
|
|
7
|
use Games::Worms::Random; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
171
|
|
6
|
|
|
|
|
|
|
@ISA = ('Games::Worms::Random'); |
7
|
|
|
|
|
|
|
$Debug = 0; |
8
|
|
|
|
|
|
|
$VERSION = "0.60"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Games::Worms::Random2 -- class for consistent random worms |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
perl -MGames::Worms -e worms -- -tTk Games::Worms::Random2 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Worms in the class Games::Worms::Random2 are random, but consistent -- |
22
|
|
|
|
|
|
|
that is, a worm in this class, upon meeting a new context, will choose |
23
|
|
|
|
|
|
|
at random which way to go, and then will associate that context with |
24
|
|
|
|
|
|
|
that move; and for the rest of its life, given that context, it will |
25
|
|
|
|
|
|
|
move in that direction. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Games::Worms::Random2 is implemented by simply inheriting from |
28
|
|
|
|
|
|
|
Games::Worms::Random, but setting memoization to true. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This simple change leads to worms that often behave rather like Beeler |
31
|
|
|
|
|
|
|
worms, but sometimes behave astonishingly differently. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
0
|
|
sub am_memoized { 1; } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |