Blackjack Strategy
This calculator generates blackjack strategy tables based on the rule settings you select.
$used = array(); $isPostBack = isset($_REQUEST["btn"]); if ($isPostBack) { $decks = (int) $_REQUEST["decks"]; if ($decks < 1 || $decks > 3) { $isPostBack = false; } $soft17 = (string) $_REQUEST["soft17"]; switch ($soft17) { case "hit": case "stand": break; default: $isPostBack = false; } $doubleon = (string) $_REQUEST["doubleon"]; switch ($doubleon) { case "any2cards": case "9to11": break; default: $isPostBack = false; } $surrender = (string) $_REQUEST["surrender"]; switch ($surrender) { case "early": case "late": case "no": break; default: $isPostBack = false; } $rules = "d".$decks."s17".$soft17[0]."don".$doubleon[0]."s".$surrender[0]; if (isset($_REQUEST["peek"])) $rules .= "pk"; if (isset($_REQUEST["das"])) $rules .= "das"; $rows = array( "5-7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17+", "A,2", "A,3", "A,4", "A,5", "A,6", "A,7", "A,8", "A,9", "2,2", "3,3", "4,4", "5,5", "6,6", "7,7", "8,8", "9,9", "10,10", "A,A"); $bg = array( "H" => "lime", "H*" => "yellow", "D" => "blue", "S" => "red", "Ds"=> "#00ffff", "P" => "white", "R" => "#181818", "Rs"=> "orange" ); $color = array( "H" => "black", "H*" => "black", "D" => "black", "S" => "black", "Ds"=> "black", "P" => "black", "R" => "white", "Rs"=> "black" ); require(dirname(__FILE__) . "/bj_strategies/".$rules.".php"); if ($surrender == "early") { $es_strategy = $strategy; $ns_rules = "d".$decks."s17".$soft17[0]."don".$doubleon[0]."sn"; if (isset($_REQUEST["peek"])) $ns_rules .= "pk"; if (isset($_REQUEST["das"])) $ns_rules .= "das"; require(dirname(__FILE__) . "/bj_strategies/".$ns_rules.".php"); for ($i=0; $i < 29; $i++) $es_strategy[$i][9] = $strategy[$i][9]; $strategy = $es_strategy; } if (isset($_REQUEST["dsa"])) { for ($i=0; $i < 10; $i++) $strategy[28][$i] = "P"; } } ?> if ($isPostBack) { ?>
,
,
Double on
Peek, DAS,
Peek, DAS,
Your Hand | Dealer's Face-up Card | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | A | |
for ($j=0; $j < 10; $j++) { $used[$strategy[$i][$j]] = true; ?> | } ?> | |||||||||
H |
Hit |
|||||||||
H* |
Hit with 2 cards, Stand with 3+ cards |
|||||||||
S |
Stand |
|||||||||
D |
Double if Possible, Otherwise Hit |
|||||||||
Ds |
Double if Possible, Otherwise Stand |
|||||||||
P |
Split (Pair) |
|||||||||
R |
Surrender if Possible, Otherwise Hit |
|||||||||
Rs |
Surrender if Possible, Otherwise Stand |
} ?>