function print_deck(Deck $deck) { echo "Deck ID: {$deck->getId()}\n"; echo "Cards: \n"; foreach ($deck->getCards() as $card) { print_card($card); } }
<?php require_once __DIR__ . '/../bootstrap.php'; use DeckOfCards\Domain\Deck; use DeckOfCards\Domain\DeckId; use DeckOfCards\Application\Commands\DrawCard; use DeckOfCards\Application\Commands\DrawCardHandler; use DeckOfCards\Infrastructure\Repositories\InMemoryDeckRepository; $decks = new InMemoryDeckRepository(); $deckId = DeckId::generate(); $decks->add(Deck::standard($deckId)); $locator->addHandler(new DrawCardHandler($decks), DrawCard::class); $card = $bus->handle(new DrawCard((string) $deckId)); print_card($card); echo "\n";
if (get_value($ai_card) > 21) { print "Bank <font color=red><b>BUSTED</b></font><br><br>"; } else { print "Bank has " . get_value($ai_card) . "<br><br>"; } print "</div>"; } print "<hr style=\"border:1px solid green;width:50%\" noshade>"; $i = 1; $val1 = get_value($player_card); print "<div align=center>Your Cards are</div><br><table align=center><tr>"; foreach ($player_card as $key => $value) { if ($i == 4 || $i == 7 || $i == 10) { print "</tr><tr>"; } print_card($value, TRUE); $i++; } print "</td></tr></table>"; print "<div align=center>You have a total of " . get_value($player_card) . " </div><br>"; //check for win if ($do == "STAY") { $win = check_for_win(get_value($ai_card), get_value($player_card)); } print "<div align=center>"; if (get_value($player_card) > 21) { print "You have <font color=red><b>BUSTED</b></font>"; $bet = $var["bet"]; $player->update_stat('blackjack_lose', $bet); $container = array(); $container["url"] = "skeleton.php";