A card drawing simulation with trials

\n"; } for ($g = 0; $g < $GAMES; $g++) { if ($g >= $numlines) { // stop printing $printline = 0; } shuffleDeck(); $handCount = 0; $foundCount = 0; while (count($deck) > 0) { $card = dealCard(); if ($printline) { echo $card; } switch($card) { // 1 is a target card case 1: $foundCount++; break; // didn't find anything special default: break; } // switch // just completed a hand if (++$handCount == $decksize/$players) { // do we have all the cards in one hand? if ($foundCount == $targetcard) { $totalWinners++; } $handCount = 0; $foundCount = 0; if ($printline) { echo " "; } } } // while if ($printline) { echo "
\n"; } } // for each game ?>
The total number of trials with green cards in a single hand was .

Number of cards in deck:
Number of green cards:
Number of players:
Number of trials:
Number of trials to print: