"; echo printCard($hands[$i]->c[0])." "; echo printCard($hands[$i]->c[1])." "; echo printCard($hands[$i]->c[2])." "; echo printCard($hands[$i]->c[3])." "; echo printCard($hands[$i]->c[4])."\n"; } } ?>

A Numbers simulation with players and trials

lowSum ]++; $highDealt[ $hands[$p]->highSum ]++; if ($hands[$p]->c[0] != 1) { $acesDealt[0]++; } elseif ($hands[$p]->c[1] != 1) { $acesDealt[1]++; } elseif ($hands[$p]->c[2] != 1) { $acesDealt[2]++; } elseif ($hands[$p]->c[3] != 1) { $acesDealt[3]++; } else { $acesDealt[4]++; } $rankDealt[ $hands[$p]->rank ]++; } // for each player $cardsOut = array(); $playersOut = array(); // while we haven't flipped 7 unique cards AND // there are cards in the deck AND // everyone still has at least one card while (count($cardsOut) < 7 && count($deck) > 0 && count($playersOut) == 0) { $newCard = dealCard(); // if we've already seen this card if (in_array($newCard, $cardsOut)) { continue; } // add the new card to the list of exposed cards $cardsOut[] = $newCard; for ($p = 0; $p < $NUM_PLAYERS; $p++) { if ($hands[$p]->removeCard($newCard)) { $playersOut[] = $p; } } } // for each card flip // someone went out if (count($playersOut) > 0) { $lowWinners[0]++; $highWinners[0]++; $outTotal[count($playersOut)]++; $outCardsTotal[count($cardsOut)]++; $olowWinners[ $hands[$playersOut[0]]->olowSum ]++; $ohighWinners[ $hands[$playersOut[0]]->ohighSum ]++; if (count($playersOut) > 1) { $lowTie++; $highTie++; } else { $sweep++; } if ($hands[$playersOut[0]]->oc[0] != 1) { $acesHighWin[0]++; $acesLowWin[0]++; } elseif ($hands[$playersOut[0]]->oc[1] != 1) { $acesHighWin[1]++; $acesLowWin[1]++; } elseif ($hands[$playersOut[0]]->oc[2] != 1) { $acesHighWin[2]++; $acesLowWin[2]++; } elseif ($hands[$playersOut[0]]->oc[3] != 1) { $acesHighWin[3]++; $acesLowWin[3]++; } else { $acesHighWin[4]++; $acesLowWin[4]++; } $rankLowWin[ $hands[$playersOut[0]]->rank ]++; $rankHighWin[ $hands[$playersOut[0]]->rank ]++; } // no one went out else { $minLow = 50; $maxHigh = 0; $wpLow = -1; $wpHigh = -1; $potentialLowTie = -1; $potentialHighTie = -1; $tempLowTie = 0; $tempHighTie = 0; for ($p = 0; $p < $NUM_PLAYERS; $p++) { if ($hands[$p]->lowSum < $minLow) { $minLow = $hands[$p]->lowSum; $wpLow = $p; $potentialLowTie = -1; $tempLowTie = 0; } elseif ($hands[$p]->lowSum == $minLow) { $potentialLowTie = $p; $tempLowTie++; } if ($hands[$p]->highSum > $maxHigh) { $maxHigh = $hands[$p]->highSum; $wpHigh = $p; $potentialHighTie = -1; $tempHighTie = 0; } elseif ($hands[$p]->highSum == $maxHigh) { $potentialHighTie = $p; $tempHighTie++; } } $lowWinners[ $hands[$wpLow]->lowSum ]++; $highWinners[ $hands[$wpHigh]->highSum ]++; $outTotal[0]++; $outCardsTotal[0]++; $olowWinners[ $hands[$wpLow]->olowSum ]++; $ohighWinners[ $hands[$wpHigh]->ohighSum ]++; if ($tempHighTie > 0) { $highTie++; } if ($tempLowTie > 0) { $lowTie++; } // to win both, you cannot tie if ($wpLow == $wpHigh && $tempHighTie == 0 && $tempLowTie == 0) { $sweep++; } if ($hands[$wpLow]->oc[0] != 1) { $acesLowWin[0]++; } elseif ($hands[$wpLow]->oc[1] != 1) { $acesLowWin[1]++; } elseif ($hands[$wpLow]->oc[2] != 1) { $acesLowWin[2]++; } elseif ($hands[$wpLow]->oc[3] != 1) { $acesLowWin[3]++; } else { $acesLowWin[4]++; } if ($hands[$wpHigh]->oc[0] != 1) { $acesHighWin[0]++; } elseif ($hands[$wpHigh]->oc[1] != 1) { $acesHighWin[1]++; } elseif ($hands[$wpHigh]->oc[2] != 1) { $acesHighWin[2]++; } elseif ($hands[$wpHigh]->oc[3] != 1) { $acesHighWin[3]++; } else { $acesHighWin[4]++; } $rankLowWin[ $hands[$wpLow]->rank ]++; $rankHighWin[ $hands[$wpHigh]->rank ]++; } // else no one went out } // for each game ?>
There were sweeps.
There were ties for low.
There were ties for high.

  0 1 2 3
Players Going Out

  Wins / Occurances by Aces
0 1 2 3 4
Low / / / / /
High / / / / /

  Wins / Occurances by Rank
No Pair 1 Pair 2 Pair 3 of a Kind Full House 4 of a Kind
Low / / / / / /
High / / / / / /

  No one
Out
# of Cards Played when Someone Goes Out
1
Games

Starting Hands - Low Statistics: Wins / Occurances
/

Starting Hands - High Statistics: Wins / Occurances
/

Actual Winning Low Hands

Actual Winning High Hands
0
c = $a; $this->oc = $a; $tempSum = 0; $aces = 0; for ($i = 0; $i < count($a); $i++) { $tempSum += $a[$i]; if ($a[$i] == 1) { $aces++; } } $this->highSum = $this->ohighSum = $tempSum % 100 + $aces * 14; $this->lowSum = $this->olowSum = $tempSum % 100; $this->rankHand(); } function rankHand() { // 4 of a kind if ($this->c[0] == $this->c[3] || $this->c[1] == $this->c[4]) { $this->rank = 5; } // Full House elseif ($this->c[0] == $this->c[2] && $this->c[3] == $this->c[4] || $this->c[0] == $this->c[1] && $this->c[2] == $this->c[4]) { $this->rank = 4; } // 3 of a kind elseif ($this->c[0] == $this->c[2] || $this->c[1] == $this->c[3] || $this->c[2] == $this->c[4] ) { $this->rank = 3; } // 2 pair elseif ($this->c[0] == $this->c[1] && $this->c[2] == $this->c[3] || $this->c[0] == $this->c[1] && $this->c[3] == $this->c[4] || $this->c[1] == $this->c[2] && $this->c[3] == $this->c[4]) { $this->rank = 2; } // 1 pair elseif ($this->c[0] == $this->c[1] || $this->c[1] == $this->c[2] || $this->c[2] == $this->c[3] || $this->c[3] == $this->c[4] ) { $this->rank = 1; } // 0 pair else { $this->rank = 0; } } // rankHand() function removeCard ($card) { for ($i = 0; $i < 5; $i++) { if ($this->c[$i] == $card) { $this->c[$i] = 0; $this->highSum -= $card % 100; $this->lowSum -= $card % 100; if ($card == 1) { $this->highSum -= 14; } } } return $this->lowSum == 0; } } // Hand class ?>