GitList
Repositories
Help
Report an Issue
blackjack
Code
Commits
Branches
Tags
Search
Tree:
d7b0224
Branches
Tags
master
blackjack
Objects
Dealer.php
initial commit
Dev Ghai
commited
d7b0224
at 2014-04-17 16:55:27
Dealer.php
Blame
History
Raw
<?php /** * User: dev * Date: 3/16/14 * Time: 10:52 PM */ namespace Blackjack\Objects; use Blackjack\Config\Config; require_once 'PlayerBase.php'; class Dealer extends PlayerBase { private $firstCard = null; public function __construct(Config $config, Hand $hand, Card $firstCard) { //remove the first card from the hand and store it in the class //variable. $this->firstCard = $firstCard; parent::__construct($config, $hand, 'Dealer'); } public function Hit(Card $card) { //add the card stored in $firstCard if we are taking a hit. if($this->firstCard != null) { $retVal = parent::Hit(0, $this->firstCard); $this->firstCard = null; return $retVal; } return parent::Hit(0, $card); } public function GetSum() { return $this->hands[0]->GetSum(); } public function SetState($stateConstant) { return parent::$hands[0]->SetState($stateConstant); } }