Here's the function: (translation: Cartas = Cards, naipes = Suits, baralho = Deck - that's what the vars mean)
function start_deck(){
$cartas = array("A","2","3","4","5","6","7","8","9","10","J","Q","K");
$naipes = array("c","s","d","h");
$baralho = array();
foreach($cartas as $c){
foreach($naipes as $n){
$baralho[] = $c . $n;
}
}
srand(microtime() * 100000 + rand());
shuffle($baralho);
$this->deck = $baralho;
$this->pointer = 0;
mysql_query("UPDATE blackjack SET baralho = '".implode(",",$baralho)."' WHERE id = " . $this->game_id);
}
I'm just scratching my head over a hand here... I just log hands to check the system, so I don't know the user. It went:
pocket: 8,2 (hit) - 10
3rd card: A - 11/21
then... 4th card: K
If he already had 21 why hit again? Or did the system took a while to respond and he hit again? Or wasn't aware of the game's goal... Really got me confuse.