BlackJack/Player/DealerPlayer.pm

filter: Statementstmt 64.7% 11 / 17 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 45.1% 14 / 31 CC 4 SCAR 24.7
CC
4
Cov
46%
decide_simple
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« BlackJack.pm ↑ Summary BlackJack/Shoe.pm »
1 package Games::Tournament::BlackJack::Player::DealerPlayer;
2 # dealer player for blackjack
3 # -- follows standard vegas casino rules on dealer behavior:
4 # -- hit on soft 17 or less, stand on hard 17 or more
5  
6 1 ▶use Games::Tournament::BlackJack::Player;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Games::Tournament::BlackJack::Utilities;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 @ISA = qw(Games::Tournament::BlackJack::Player);
10  
11  
12 # decide_simple returns true for hit, false for stand.
13
14 0 ▶sub decide_simple {
Subroutine decide_simple: not called CC=4 SCAR=30.0
Pod undocumented
15 0 my $self = shift;
16 0 my $hit_threshold = 16; # hit on hard 16 or less
17 0 my $handValue = $self->myHandValue();
18
19 0 ▶ if ($handValue == 17 and $self->isHandSoft()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($handValue == 17 and $self->isHandSoft) 0 0 0
Condition0%0/3
$handValue == 17 and $self->isHandSoft
!ll&&!rl&&r
000
MC/DC0%0/2
$handValue == 17 and $self->isHandSoft
$handValue == 17 $self->isHandSoft
Truth table0%0/3
A and B
A= $handValue == 17B= $self->isHandSoft
ABresult
0X0
100
111
20 0 return 'hit'; # on a soft 17
21 }
22
23 # otherwise, hit on hard 16 or less as usual.
24 0 ▶ return ($handValue <= $hit_threshold) ? 'hit' : 'stand';
Branch: 1 branch
BranchTrueFalseTotal
$handValue <= $hit_threshold ? : 0 0 0
25 }
26  
27 1 1;
« BlackJack.pm ↑ Summary BlackJack/Shoe.pm »