Skip to content

Instantly share code, notes, and snippets.

@josephjaniga
Created June 7, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephjaniga/f78fa1c4717d1aa6e2ae to your computer and use it in GitHub Desktop.
Save josephjaniga/f78fa1c4717d1aa6e2ae to your computer and use it in GitHub Desktop.
<?php
class Player implements CanPlayBlackJack
{
protected $hands = [];
protected $activeHand = 0;
protected $conreteStrategy; // strategyInterface
function __construct()
{
array_push($this->hands, new Hand());
}
public function addToHand(Card $card)
{
$this->hands[$this->activeHand]->addCard($card);
}
public function chooseAction($status)
{
return $concreteStrategy->determineAction($status);
//return BlackJackGame::ACTION_STAND;
}
public function discardAllFromHands()
{
unset($this->hands);
$this->hands = [];
array_push($this->hands, new Hand());
}
}
@IronCollectionMilkshake
Copy link

hola

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment