File Coverage

blib/lib/Games/Tournament/BlackJack/Player/ExamplePlayer2.pm
Criterion Covered Total %
statement 6 9 66.6
branch n/a
condition 0 2 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 8 15 53.3


line stmt bran cond sub pod time code
1             package Games::Tournament::BlackJack::Player::ExamplePlayer2;
2             # (very simple) example player module for blackjack
3             # this player will hit on a 16 or less by default, or the theshold
4             # he is sent in the initialization parameter "hit_threshold".
5              
6              
7 1     1   7 use Games::Tournament::BlackJack::Player;
  1         3  
  1         30  
8 1     1   7 use Games::Tournament::BlackJack::Utilities;
  1         2  
  1         163  
9             @ISA = qw(Games::Tournament::BlackJack::Player);
10              
11             # decide_simple returns true for hit, false for stand.
12             sub decide_simple {
13 0     0 0   my $self = shift;
14 0   0       my $hit_threshold = $self->{'hit_threshold'} || 16; # hit on 16 or less _by_default_
15 0           return (handValue($self->{'hand'}) <= $hit_threshold);
16             }
17              
18             1;