BlackJack/Player/ExamplePlayer2.pm

filter: Statementstmt 72.7% 8 / 11 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 2 / 3 Podpod 0.0% 0 / 1 totaltotal 55.5% 10 / 18 CC 2 SCAR 12.5
CC
2
Cov
62%
decide_simple
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« BlackJack/Player/HumanPlayer.pm ↑ Summary
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 ▶use Games::Tournament::BlackJack::Player;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Games::Tournament::BlackJack::Utilities;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 @ISA = qw(Games::Tournament::BlackJack::Player);
10  
11 # decide_simple returns true for hit, false for stand.
12 0 ▶sub decide_simple {
Subroutine decide_simple: not called CC=2 SCAR=17.9
Pod undocumented
13 0 my $self = shift;
14 0 ▶ my $hit_threshold = $self->{'hit_threshold'} || 16; # hit on 16 or less _by_default_
Condition0%0/2
$self->{'hit_threshold'} || 16
l!l
00
MC/DC0%0/1
$self->{'hit_threshold'} || 16
$self->{'hit_threshold'}
Truth table0%0/2
A
A= $self->{'hit_threshold'}
Aresult
11
00
15 0 return (handValue($self->{'hand'}) <= $hit_threshold);
16 }
17  
18 1 1;
« BlackJack/Player/HumanPlayer.pm ↑ Summary