| 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
Condition0%0/3
$handValue == 17 and $self->isHandSoft
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 1 | 1; | |||||||||||||||||||||||||||