Esempio n. 1
0
$simon = new Player("Simon");
$jerry = new Player("Jerry");
// Put all players into an array
$allPlayers = array($jared, $samir, $alex, $traci, $brian, $simon, $jerry);
// Instantiate the dealer with the array of players, the number of cards to deal them, and the deck of cards
$dealer = new Dealer($allPlayers, 3, $deck);
// Make sure no additional decks are needed
echo $dealer->setupGame();
// Format game
echo "<div class='table'>";
// Show the deck face down
echo "<div class='headline'><b>The Deck</b></div>";
echo $dealer->showDeck();
echo "<div class='divider'></div>";
// Deal the cards to all players
$dealer->deals();
// Show the players' hands
echo "<div class='headline'>Player's Hands</div>";
foreach ($allPlayers as $player) {
    echo $player->showHand();
}
echo "<div class='divider'></div>";
// Show the players' scores
echo "<div class='headline'><b>Score</b></div>";
$dealer->scoreGame();
echo $dealer->showScores();
echo "<div class='divider'></div>";
// Determine and display a winner
echo "<div class='headline'><b>And The Winner Is...</b></div>";
$dealer->determineWinners();
echo $dealer->showWinners();