{ // todo } // print out a hand of cards // name is the name of the player // hidden is to initially show only first card of hand (for dealer) // output should look like this: // Dealer: [4 C] [???] Total: ??? // or: // Player: [J D] [2 D] Total: 12 function echoHand($hand, $name, $hidden = false) { // todo } // build the deck of cards $deck = buildDeck($suits, $cards); // initialize a dealer and player hand $dealer = []; $player = []; // dealer and player each draw two cards // todo // echo the dealer hand, only showing the first card // todo // echo the player hand // todo // allow player to "(H)it or (S)tay?" till they bust (exceed 21) or stay // while ( todo ) { // // todo // } // show the dealer's hand (all cards) // todo
function findShoe($deck) { $check = array_search('SHOE', $deck); if (!$check) { echo '*******************************' . PHP_EOL; echo "Shuffling Deck Now" . PHP_EOL; echo '*******************************' . PHP_EOL; return $deck = buildDeck(); } }
<!-- IE8 support for HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <?php include 'includes/functions.php'; ?> <body> <?php session_start(); if (isset($_POST['deal'])) { // create a deck included 51 cards $deck = buildDeck(); // draw the first 2 cards $cards = drawRandomCard($deck); // store the remaining cards $_SESSION['rest_cards'] = $cards['rest_cards']; // store cards in session for the next round $_SESSION['cards'] = $cards; // store dealer's cards for the next round $_SESSION["dealer"] = $cards['dealer']; // store players's cards for the next round $_SESSION["player"] = $cards['player']; // assign the values for the output $player = $_SESSION["player"]; // assign the value to get the result $player_value = $cards['player']; $dealer_value = $cards['dealer'];