Exemple #1
0
 /**
  * @param Dealer $dealer
  * @return SolutionHand|null
  */
 public function getWinningHand(Dealer $dealer)
 {
     $winningHand = null;
     $allCards = array_merge($this->getCards(), $dealer->getCards());
     $allCardCombos = $this->getCombinations($allCards, 5);
     foreach ($allCardCombos as $cardCombo) {
         $solutionHand = new SolutionHand($cardCombo);
         if (!$winningHand || $solutionHand->diff($winningHand) > 0) {
             $winningHand = $solutionHand;
         }
     }
     return $winningHand;
 }