line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AI::Evolve::Befunge::Critter::Result; |
2
|
5
|
|
|
5
|
|
4358
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
179
|
|
3
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
150
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
24
|
use base 'Class::Accessor::Fast'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
924
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw{ choice died fate moves name score stats tokens won } ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
52
|
|
|
52
|
1
|
471
|
my $package = shift; |
10
|
52
|
|
|
|
|
355
|
my $self = { |
11
|
|
|
|
|
|
|
died => 0, |
12
|
|
|
|
|
|
|
fate => '', |
13
|
|
|
|
|
|
|
moves => 0, |
14
|
|
|
|
|
|
|
score => 0, |
15
|
|
|
|
|
|
|
stats => {}, |
16
|
|
|
|
|
|
|
tokens => 0, |
17
|
|
|
|
|
|
|
won => 0, |
18
|
|
|
|
|
|
|
@_ |
19
|
|
|
|
|
|
|
}; |
20
|
52
|
|
|
|
|
300
|
return bless($self, $package); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
AI::Evolve::Befunge::Critter::Result - results object |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This object stores the fate of a critter. It stores whether it died |
31
|
|
|
|
|
|
|
or lived, what the error message was (if it died), whether it won, and |
32
|
|
|
|
|
|
|
if it was playing a board game, whether it choose a move. It also |
33
|
|
|
|
|
|
|
stores some statistical information about how many moves it made, and |
34
|
|
|
|
|
|
|
stuff like that. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Result->new(); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Create a new Result object. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 METHODS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Automatically generated accessor methods exist for the following |
48
|
|
|
|
|
|
|
fields: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item choice |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Indicates the choice of positions to play (for board game physics |
55
|
|
|
|
|
|
|
engines). |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item died |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Integer value, true if the critter died. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item fate |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
String value, indicates the error message returned by eval, to |
64
|
|
|
|
|
|
|
indicate the reason for a critter's death. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item name |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Name of the critter, according to its blueprint. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item score |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Integer value supplied by the Physics engine, indicates how well it |
73
|
|
|
|
|
|
|
thought the critter did. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item stats |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Some additional statistics generated by the run_board_game method in |
78
|
|
|
|
|
|
|
Physics.pm. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item tokens |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Integer value indicating how much "currency" the critter had left |
83
|
|
|
|
|
|
|
over. Higher numbers mean the critter consumed fewer resources. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item won |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Integer value, true if the critter won (as determined by the Physics |
88
|
|
|
|
|
|
|
engine). |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
These values may be set using the accessors (like: $result->died(1) ), |
94
|
|
|
|
|
|
|
or they may be initialized by the constructor (like: |
95
|
|
|
|
|
|
|
Result->new(died => 1) ). |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |