Exemple #1
0
 public function hit(Dealer $f_objPlayer, $f_bForced = false)
 {
     if (21 <= $f_objPlayer->score()) {
         return false;
     }
     $objNextCard = $this->deck->next();
     if (!$objNextCard) {
         // out of cards, bad value for blackjack::cut_card
         $this->gameover = true;
         $this->player->stands = true;
         $this->dealer->stands = true;
         $this->winner = $this->player;
         $this->player->payout = 2 * $this->player->bet;
         $this->player->balance += $this->player->payout;
         return false;
     }
     $f_objPlayer->receive($objNextCard);
     if (21 <= $f_objPlayer->score() && !$f_bForced) {
         if ($this->player === $f_objPlayer) {
             $this->dealerPlays();
         }
     }
     return true;
 }