line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wx::App::Mastermind::Player::Human; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2231
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
5
|
1
|
|
|
1
|
|
6
|
use base qw(Wx::App::Mastermind::Player); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
293
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
0
|
|
|
0
|
1
|
|
my( $class, @args ) = @_; |
9
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new( @args ); |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
return $self; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
0
|
|
sub moves_editable { 1 } |
15
|
0
|
|
|
0
|
0
|
|
sub answers_editable { 0 } |
16
|
0
|
|
|
0
|
0
|
|
sub play { } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub create_listener { |
19
|
0
|
|
|
0
|
0
|
|
my( $self, $game ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return Wx::App::Mastermind::Player::HumanListener->new( $game ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
package Wx::App::Mastermind::Player::HumanListener; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
40
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
27
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
28
|
1
|
|
|
1
|
|
5
|
use base qw(Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
306
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( qw(game) ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
0
|
|
|
0
|
|
|
my( $class, $game ) = @_; |
34
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new( { game => $game } ); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return $self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub on_move { |
40
|
0
|
|
|
0
|
|
|
my( $self, $item, $event, %params ) = @_; |
41
|
0
|
|
|
|
|
|
my $answer = $self->game->play( @{$params{move}} ); |
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$item->player->add_answer( $answer ); |
44
|
0
|
|
|
|
|
|
$item->player->turn_finished; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
|
|
sub on_answer { } |
48
|
0
|
|
|
0
|
|
|
sub reset { $_[0]->game->reset } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |