473,602 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

For Fun: Blackjack Simulator

Rabbit
12,516 Recognized Expert Moderator MVP
Introduction
Have you wondered what the house edge is given a particular rule set? Can you really beat the house by counting cards? How big is that advantage really? Is it really the best strategy to hit a hard 16 when the dealer is showing a 7? All these and more can be answered with this VBScript blackjack simulator. Plug in the rules you want to test, modify basic strategy, count values, indices, betting ramps, and more. See how they all affect the overall house edge!

How To Use
Most of the script parameters are in the constant definitions at the top of script after the comments. The rest are at the bottom in the Initialize subroutine. This is where the betting ramps, indices, basic strategy, and count values are defined.

You can find a basic strategy calculator here: http://wizardofodds.com/games/blackj...gy/calculator/

Performance Stats
It takes about 10 minutes, give or take a minute, to simulate one million games of two-deck blackjack.

Miscellaneous Info
A negative advantage means that it favors the house and you lost money over the simulation. A standard rule set with no counting and perfect basic strategy play favors the house by about half a percent.

The count that is simulated can flip that to about 1.6 percent in your favor. It's a very small advantage that results in very wide variance in any one session of play. What this means is at any one session, you can lose money. But over many games, you are up just a little bit. You can see this by running the script many times for a small number of simulations, say about 20 games of blackjack. The advantage reported will fluctuate back and forth between negative and positive. But run it for lots and lots of simulations and you see your true advantage play out.

The key takeaway is don't expect counting to turn every session of blackjack into a winning one.

CODE
Expand|Select|Wrap|Line Numbers
  1. ' real world blackjack simulation
  2. ' designed with KO variant (OK qfit.com) indexes in mind
  3. ' modify constants, basic strategy, betting ramps, indexes, and count values as needed
  4. ' default values are for 2 decks, KO variant count, no double after split, dealer hits soft 17, late surrender allowed
  5. '
  6. ' created on 10/31/2014
  7. ' version 1.0
  8. '
  9. ' possible additions:
  10. ' add ability to calculate true count for balanced count systems
  11. ' add basic strategy defaults based on rule sets
  12. ' add ability to choose counting strategy
  13. ' add count values based on counting strategy
  14. ' add betting ramp values based on counting strategy
  15. ' add indexes based on counting strategy
  16. ' add initial count and insurance count based on counting strategy
  17. ' modify penetration to use percentage
  18. ' add constant for turning on and off surrender
  19. ' add rate of error on count as a way to account for human errors or to disguise counting
  20. ' add rate of error on basic strategy as a way to account for human errors or to disguise counting
  21. ' add sessions: session max loss before stopping, session max win before stopping
  22. ' stop playing deck after count gets below a certain number
  23. ' test up and pull betting system, streak count
  24. ' add other players at table with choice to pick position
  25. '
  26. ' strategy key:
  27. ' S = stand
  28. ' RS = surrender, otherwise stand
  29. ' H = hit
  30. ' RH = surrender, otherwise hit
  31. ' DH = double, otherwise hit
  32. ' DS = double, otherwise stand
  33. ' P = split
  34. ' RP = surrender, otherwise split
  35.  
  36. Option Explicit
  37.  
  38. Const NumSims = 1000000
  39. Const NumDecks = 2
  40. Const Penetration = 70 ' Number of cards dealt after which the deck is shuffled
  41. Const InitialCount = -4 ' For KO variant count, initial count is (Number of Decks - 1) * -4
  42. Const BurnCards = 1 ' Number of cards burned before first hand is dealt
  43. Const InsuranceCount = 3 ' Set to high number if you never want to take insurance
  44. Const NumMaxSplits = 4 ' Max 4
  45. Const BJPayoutAmount = 1.5 ' Use 1.5 for 3:2 and 1.2 for 6:5
  46. Const AllowDoubleAfterSplit = False
  47. Const CanHitSplitAces = False
  48. Const CanResplitAces = False
  49. Const DealerHitSoft17 = True
  50. Const Auditing = False
  51. Const UseIndexes = True
  52. Const UseBettingRamp = True
  53. Const LetItRide = False ' Modify bet downwards only if last hand was a loss. Usually used as one method of camoflaging counting.
  54. Const UseFibonnaciBetting = False
  55. Const AuditFileLocation = "C:\IBM\results.txt"
  56.  
  57. Dim StandardDeck(51, 1), Decks(), BettingRamp(3, 1), CountValues(10)
  58. Dim HardStrategy(21, 10), SoftStrategy(21, 10), SplitStrategy(10, 10), Indexes(8, 4)
  59. Dim runningCount, deckPosition, simCount, bankRoll, betSize, wagers
  60. Dim handCards(4, 9), handData(4, 3), numHands, i, strDecision, lastHandWon, lastBet
  61. Dim lowBankRoll, highBankRoll, numHandsPlayed, j, startTime, endTime
  62. Dim f, x, s
  63.  
  64. If Auditing Then Set f = CreateObject("Scripting.FileSystemObject").CreateTextFile(AuditFileLocation)
  65.  
  66. ' Indexes:
  67. ' 0 = runningCount value
  68. ' 1 = hand value
  69. ' 2 = dealer face up card
  70. ' 3 = new strategy
  71.  
  72. ' BettingRamp:
  73. ' 0 = runningCount value
  74. ' 1 = betSize at value
  75.  
  76. ' handData:
  77. ' 0 = amount bet
  78. ' 1 = hand value
  79. ' 2 = soft hand indicator
  80. ' 3 = number of cards
  81.  
  82. Initialize()
  83. InitializeDecks(NumDecks)
  84.  
  85. For simCount = 1 To NumSims
  86.     ShuffleDecks()
  87.  
  88.     If Auditing Then 
  89.         f.WriteLine "Shuffle " & simCount
  90.         For x = 0 To UBound(Decks)
  91.             f.WriteLine Decks(x, 0) & Decks(x, 1)
  92.         Next
  93.         f.WriteLine ""
  94.     End If
  95.  
  96.     runningCount = InitialCount
  97.     deckPosition = BurnCards
  98.     betSize = 1
  99.  
  100.     Do Until deckPosition > Penetration
  101.         Erase handCards
  102.         Erase handData
  103.         numHands = 1
  104.  
  105.         betSize = 1
  106.         If UseBettingRamp Then
  107.             For i = 0 To UBound(BettingRamp)
  108.                 If runningCount >= BettingRamp(i, 0) Then
  109.                     betSize = BettingRamp(i, 1)
  110.                 End If
  111.             Next
  112.         End If
  113.  
  114.         If LetItRide Then
  115.             If lastHandWon = True And lastBet > betSize Then
  116.                 betSize = lastBet
  117.             End If
  118.             lastBet = betSize
  119.             lastHandWon = False
  120.         End If
  121.  
  122.         If Auditing Then f.WriteLine "New Hand, Count = " & runningCount & ", Bet = " & betSize & ", Bankroll = " & bankRoll
  123.  
  124.         handData(1, 0) = betSize
  125.         handData(1, 3) = 2
  126.         handData(0, 3) = 2
  127.  
  128.         ' Player's first card
  129.         handCards(1, 0) = deckPosition
  130.         If Decks(deckPosition, 0) = 1 Then 
  131.             handData(1, 1) = 11
  132.             handData(1, 2) = 1
  133.         Else
  134.             handData(1, 1) = Decks(deckPosition, 0)
  135.         End If
  136.         runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  137.         deckPosition = deckPosition + 1
  138.  
  139.         ' Dealer's first card
  140.         handCards(0, 0) = deckPosition
  141.         If Decks(deckPosition, 0) = 1 Then 
  142.             handData(0, 1) = 11
  143.             handData(0, 2) = 1
  144.         Else
  145.             handData(0, 1) = Decks(deckPosition, 0)
  146.         End If
  147.         deckPosition = deckPosition + 1
  148.  
  149.         ' Player's second card
  150.         handCards(1, 1) = deckPosition
  151.         If Decks(deckPosition, 0) = 1 And handData(1, 1) + 11 <= 21 Then 
  152.             handData(1, 1) = handData(1, 1) + 11
  153.             handData(1, 2) = 1
  154.         Else
  155.             handData(1, 1) = handData(1, 1) + Decks(deckPosition, 0)
  156.         End If
  157.         runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  158.         deckPosition = deckPosition + 1
  159.  
  160.         ' Dealer's second card
  161.         handCards(0, 1) = deckPosition
  162.         If Decks(deckPosition, 0) = 1 And handData(0, 1) + 11 <= 21 Then 
  163.             handData(0, 1) = handData(0, 1) + 11
  164.             handData(0, 2) = 1
  165.         Else
  166.             handData(0, 1) = handData(0, 1) + Decks(deckPosition, 0)
  167.         End If
  168.         runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  169.         deckPosition = deckPosition + 1
  170.  
  171.         If Auditing Then 
  172.             f.WriteLine "Dealer Face Up Card: " & Decks(handCards(0, 1), 0) & Decks(handCards(0, 1), 1)
  173.             f.WriteLine "Player's Cards:      " & Decks(handCards(1, 0), 0) & Decks(handCards(1, 0), 1) & ", " & Decks(handCards(1, 1), 0) & Decks(handCards(1, 1), 1)
  174.             f.WriteLine "New Count: " & runningCount
  175.         End If
  176.  
  177.         If runningCount >= InsuranceCount And Decks(handCards(0, 1), 0) = 1 Then
  178.             wagers = wagers + (handData(1, 0) / 2)
  179.             If handData(0, 1) <> 21 Then
  180.                 bankRoll = bankRoll - (handData(1, 0) / 2)
  181.                 If Auditing Then f.WriteLine "Took Insurance, Dealer did not have 21, Bankroll = " & bankRoll
  182.             Else
  183.                 bankRoll = bankRoll + (handData(1, 0) / 2) * 3
  184.                 If Auditing Then f.WriteLine "Took Insurance, Dealer had 21, Bankroll = " & bankRoll
  185.             End If
  186.         End If
  187.  
  188.         If handData(0, 1) = 21 Then
  189.             If handData(1, 1) <> 21 Then
  190.                 bankRoll = bankRoll - handData(1, 0)
  191.                 If Auditing Then f.WriteLine "Hand Outcome: Dealer Blackjack, Bankroll = " & bankRoll
  192.             End If
  193.         ElseIf handData(1, 1) = 21 Then
  194.             bankRoll = bankRoll + handData(1, 0) * BJPayoutAmount
  195.             If Auditing Then f.WriteLine "Hand Outcome: Player Blackjack"
  196.             lastHandWon = True
  197.         ElseIf handData(1, 2) = 1 And Left(SoftStrategy(handData(1, 1), Decks(handCards(0, 1), 0)), 1) = "R" Then
  198.             bankRoll = bankRoll - (handData(1, 0) / 2)
  199.             If Auditing Then f.WriteLine "Hand Outcome: Surrender, Bankroll = " & bankRoll
  200.         ElseIf handData(1, 2) <> 1 And Left(HardStrategy(handData(1, 1), Decks(handCards(0, 1), 0)), 1) = "R" Then
  201.             bankRoll = bankRoll - (handData(1, 0) / 2)
  202.             If Auditing Then f.WriteLine "Hand Outcome: Surrender, Bankroll = " & bankRoll
  203.         ElseIf Decks(handCards(1, 0), 0) = Decks(handCards(1, 1), 0) And Left(SplitStrategy(Decks(handCards(1, 0), 0), Decks(handCards(0, 1), 0)), 1) = "R" Then
  204.             bankRoll = bankRoll - (handData(1, 0) / 2)
  205.             If Auditing Then f.WriteLine "Hand Outcome: Surrender, Bankroll = " & bankRoll
  206.         Else
  207.             ' Handle splits
  208.             i = 1
  209.             Do Until i > numHands
  210.                 If Decks(handCards(i, 0), 0) = Decks(handCards(i, 1), 0) And Right(SplitStrategy(Decks(handCards(1, 0), 0), Decks(handCards(0, 1), 0)), 1) = "P" And numHands < NumMaxSplits Then
  211.                     numHands = numHands + 1
  212.                     handData(numHands, 0) = handData(i, 0)
  213.                     handData(numHands, 2) = handData(i, 2)
  214.                     handData(numHands, 3) = 2
  215.                     handCards(numHands, 0) = handCards(i, 1)
  216.  
  217.                     If Decks(handCards(i, 0), 0) = 1 Then
  218.                         handData(numHands, 1) = 11
  219.                         handData(i, 1) = 11
  220.                     Else
  221.                         handData(numHands, 1) = Decks(handCards(i, 0), 0)
  222.                         handData(i, 1) = Decks(handCards(i, 0), 0)
  223.                     End If
  224.  
  225.                     ' Deal a card to each hand
  226.                     handCards(i, 1) = deckPosition
  227.                     If Decks(deckPosition, 0) = 1 And handData(i, 1) + 11 <= 21 Then 
  228.                         handData(i, 1) = handData(i, 1) + 11
  229.                         handData(i, 2) = 1
  230.                     Else
  231.                         handData(i, 1) = handData(i, 1) + Decks(deckPosition, 0)
  232.                     End If
  233.                     runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  234.                     deckPosition = deckPosition + 1
  235.  
  236.                     handCards(numHands, 1) = deckPosition
  237.                     If Decks(deckPosition, 0) = 1 And handData(numHands, 1) + 11 <= 21 Then 
  238.                         handData(numHands, 1) = handData(numHands, 1) + 11
  239.                         handData(numHands, 2) = 1
  240.                     Else
  241.                         handData(numHands, 1) = handData(numHands, 1) + Decks(deckPosition, 0)
  242.                     End If
  243.                     runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  244.                     deckPosition = deckPosition + 1
  245.  
  246.                     If CanResplitAces = False And Decks(handCards(1, 0), 0) = 1 Then
  247.                         i = 999
  248.                     End If
  249.                 Else
  250.                     i = i + 1
  251.                 End If
  252.             Loop
  253.  
  254.             ' Player decisions
  255.             For i = 1 To numHands
  256.                 strDecision = ""
  257.                 s = ""
  258.  
  259.                 If numHands > 1 And CanHitSplitAces = False And Decks(handCards(1, 0), 0) = 1 Then
  260.                     strDecision = "S"
  261.                 End If
  262.  
  263.                 Do Until strDecision = "S"
  264.                     If handData(i, 2) = 1 Then
  265.                         strDecision = SoftStrategy(handData(i, 1), Decks(handCards(0, 1), 0))
  266.                     Else
  267.                         strDecision = HardStrategy(handData(i, 1), Decks(handCards(0, 1), 0))
  268.                     End If
  269.  
  270.                     ' Modify decision based on count indexes
  271.                     If UseIndexes Then
  272.                         For j = 0 To UBound(Indexes)
  273.                             If runningCount >= Indexes(j, 0) Then
  274.                                 If handData(i, 1) = Indexes(j, 1) And Decks(handCards(0, 1), 0) = Indexes(j, 2) And handData(i, 2) <> 1 Then
  275.                                     strDecision = Indexes(j, 3)
  276.                                 End If
  277.                             End If
  278.                         Next
  279.                     End If
  280.  
  281.                     s = s & strDecision & ", "
  282.  
  283.                     Select Case strDecision
  284.                         Case "S"
  285.                         Case "RS"
  286.                             strDecision = "S"
  287.                         Case "H"
  288.                             ' deal a card
  289.                             handCards(i, handData(i, 3)) = deckPosition
  290.                             If Decks(deckPosition, 0) = 1 And (handData(i, 1) + 11) <= 21 Then 
  291.                                 handData(i, 1) = handData(i, 1) + 11
  292.                                 handData(i, 2) = 1
  293.                             ElseIf handData(i, 2) = 1 And (handData(i, 1) + Decks(deckPosition, 0)) > 21 Then
  294.                                 handData(i, 2) = 0
  295.                                 handData(i, 1) = handData(i, 1) - 10 + Decks(deckPosition, 0)
  296.                             Else
  297.                                 handData(i, 1) = handData(i, 1) + Decks(deckPosition, 0)
  298.                             End If
  299.                             handData(i, 3) = handData(i, 3) + 1
  300.                             runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  301.                             deckPosition = deckPosition + 1
  302.  
  303.                             ' check for bust
  304.                             If handData(i, 1) > 21 Then
  305.                                 strDecision = "S"
  306.                             End If
  307.                         Case "RH"
  308.                             ' deal a card
  309.                             handCards(i, handData(i, 3)) = deckPosition
  310.                             If Decks(deckPosition, 0) = 1 And (handData(i, 1) + 11) <= 21 Then 
  311.                                 handData(i, 1) = handData(i, 1) + 11
  312.                                 handData(i, 2) = 1
  313.                             ElseIf handData(i, 2) = 1 And (handData(i, 1) + Decks(deckPosition, 0)) > 21 Then
  314.                                 handData(i, 2) = 0
  315.                                 handData(i, 1) = handData(i, 1) - 10 + Decks(deckPosition, 0)
  316.                             Else
  317.                                 handData(i, 1) = handData(i, 1) + Decks(deckPosition, 0)
  318.                             End If
  319.                             handData(i, 3) = handData(i, 3) + 1
  320.                             runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  321.                             deckPosition = deckPosition + 1
  322.  
  323.                             ' check for bust
  324.                             If handData(i, 1) > 21 Then
  325.                                 strDecision = "S"
  326.                             End If
  327.                         Case "DH"
  328.                             If handData(i, 3) = 2 And (numHands = 1 Or AllowDoubleAfterSplit = True) Then
  329.                                 handData(i, 0) = handData(i, 0) * 2
  330.                                 strDecision = "S"
  331.                                 s = s & "Doubled, "
  332.                             End If
  333.  
  334.                             ' deal a card
  335.                             handCards(i, handData(i, 3)) = deckPosition
  336.                             If Decks(deckPosition, 0) = 1 And (handData(i, 1) + 11) <= 21 Then 
  337.                                 handData(i, 1) = handData(i, 1) + 11
  338.                                 handData(i, 2) = 1
  339.                             ElseIf handData(i, 2) = 1 And (handData(i, 1) + Decks(deckPosition, 0)) > 21 Then
  340.                                 handData(i, 2) = 0
  341.                                 handData(i, 1) = handData(i, 1) - 10 + Decks(deckPosition, 0)
  342.                             Else
  343.                                 handData(i, 1) = handData(i, 1) + Decks(deckPosition, 0)
  344.                             End If
  345.                             handData(i, 3) = handData(i, 3) + 1
  346.                             runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  347.                             deckPosition = deckPosition + 1
  348.  
  349.                             'check for bust
  350.                             If handData(i, 1) > 21 Then
  351.                                 strDecision = "S"
  352.                             End If
  353.                         Case "DS"
  354.                             strDecision = "S"
  355.  
  356.                             If handData(i, 3) = 2 And (numHands = 1 Or AllowDoubleAfterSplit = True) Then
  357.                                 handData(i, 0) = handData(i, 0) * 2
  358.                                 s = s & "Doubled, "
  359.  
  360.                                 ' deal a card
  361.                                 handCards(i, handData(i, 3)) = deckPosition
  362.                                 If Decks(deckPosition, 0) = 1 And (handData(i, 1) + 11) <= 21 Then 
  363.                                     handData(i, 1) = handData(i, 1) + 11
  364.                                     handData(i, 2) = 1
  365.                                 ElseIf handData(i, 2) = 1 And (handData(i, 1) + Decks(deckPosition, 0)) > 21 Then
  366.                                     handData(i, 2) = 0
  367.                                     handData(i, 1) = handData(i, 1) - 10 + Decks(deckPosition, 0)
  368.                                 Else
  369.                                     handData(i, 1) = handData(i, 1) + Decks(deckPosition, 0)
  370.                                 End If
  371.                                 handData(i, 3) = handData(i, 3) + 1
  372.                                 runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  373.                                 deckPosition = deckPosition + 1
  374.                             End If
  375.                         Case Else
  376.                             WScript.Echo handData(i, 1) & vbcrlf & Decks(handCards(0, 1), 0) & vbcrlf & handData(i, 2) & vbcrlf & i & _
  377.                             SoftStrategy(handData(i, 1), Decks(handCards(0, 1), 0)) & vbcrlf & HardStrategy(handData(i, 1), Decks(handCards(0, 1), 0)) & vbcrlf & _
  378.                             Decks(handCards(i, 0), 0) & "," & Decks(handCards(i, 1), 0) & vbcrlf & handData(i, 3)
  379.                     End Select
  380.                 Loop
  381.  
  382.                 If Auditing Then f.WriteLine "Hand " & i & " Decisions: " & s
  383.             Next
  384.  
  385.             ' dealer decisions
  386.             strDecision = ""
  387.             Do Until strDecision = "S"
  388.                 If handData(0, 1) < 17 Or (handData(0, 1) = 17 And handData(0, 2) = 1 And DealerHitSoft17 = True) Then
  389.                     ' deal a card
  390.                     handCards(0, handData(0, 3)) = deckPosition
  391.                     If Decks(deckPosition, 0) = 1 And (handData(0, 1) + 11) <= 21 Then 
  392.                         handData(0, 1) = handData(0, 1) + 11
  393.                         handData(0, 2) = 1
  394.                     ElseIf handData(0, 2) = 1 And (handData(0, 1) + Decks(deckPosition, 0)) > 21 Then
  395.                         handData(0, 2) = 0
  396.                         handData(0, 1) = handData(0, 1) - 10 + Decks(deckPosition, 0)
  397.                     Else
  398.                         handData(0, 1) = handData(0, 1) + Decks(deckPosition, 0)
  399.                     End If
  400.                     handData(0, 3) = handData(0, 3) + 1
  401.                     runningCount = runningCount + CountValues(Decks(deckPosition, 0))
  402.                     deckPosition = deckPosition + 1
  403.                 Else
  404.                     strDecision = "S"
  405.                 End If
  406.             Loop
  407.  
  408.             ' hand outcomes
  409.             For i = 1 To NumHands
  410.                 If Auditing Then 
  411.                     f.WriteLine "Hand " & i & " Bet = "  & handData(i, 0) & ", Value = " & handData(i, 1) & ", Soft Hand = " & handData(i, 2) & ", Number of Cards = " & handData(i, 3)
  412.                     s = ""
  413.                     For x = 0 To handData(i, 3) - 1
  414.                         s = s & Decks(handCards(i, x), 0) & Decks(handCards(i, x), 1) & ", "
  415.                     Next
  416.                     f.WriteLine "Hand " & i & " Final Cards: " & s
  417.                 End If
  418.  
  419.                 wagers = wagers + handData(i, 0)
  420.                 If handData(i, 1) > 21 Then
  421.                     ' player bust
  422.                     bankRoll = bankRoll - handData(i, 0)
  423.                     If Auditing Then f.WriteLine "Hand Outcome: Player Bust"
  424.                 ElseIf handData(0, 1) > 21 Then
  425.                     ' dealer bust
  426.                     bankRoll = bankRoll + handData(i, 0)
  427.                     lastHandWon = True
  428.                     If Auditing Then f.WriteLine "Hand Outcome: Dealer Bust"
  429.                 ElseIf handData(i, 1) < handData(0, 1) Then
  430.                     ' dealer wins
  431.                     bankRoll = bankRoll - handData(i, 0)
  432.                     If Auditing Then f.WriteLine "Hand Outcome: Dealer Wins"
  433.                 ElseIf handData(i, 1) > handData(0, 1) Then
  434.                     ' player wins
  435.                     bankRoll = bankRoll + handData(i, 0)
  436.                     lastHandWon = True
  437.                     If Auditing Then f.WriteLine "Hand Outcome: Player Wins"
  438.                 ElseIf handData(i, 1) = handData(0, 1) Then
  439.                     If Auditing Then f.WriteLine "Hand Outcome: Push"
  440.                 Else
  441.                     WScript.Echo "Hand Outcome Error"
  442.                 End If
  443.             Next
  444.         End If
  445.  
  446.         runningCount = runningCount + CountValues(Decks(handCards(0, 0), 0))
  447.         numHandsPlayed = numHandsPlayed + numHands
  448.         If bankRoll < lowBankRoll Then lowBankRoll = bankRoll
  449.         If bankRoll > highBankRoll Then highBankRoll = bankRoll
  450.  
  451.         If Auditing Then 
  452.             f.WriteLine "Dealer's Value = " & handData(0, 1) & ", Soft Hand = " & handData(0, 2) & ", Number of Cards = " & handData(0, 3)
  453.             s = ""
  454.             For i = 0 To handData(0, 3) - 1
  455.                 s = s & Decks(handCards(0, i), 0) & Decks(handCards(0, i), 1) & ", "
  456.             Next
  457.             f.WriteLine "Dealer's Final Cards: " & s
  458.  
  459.             f.WriteLine "Ending Count = " & runningCount & ", Bankroll = " & bankRoll
  460.             f.WriteLine ""
  461.         End If
  462.     Loop
  463. Next
  464.  
  465. endTime = Now()
  466. WScript.Echo _
  467.     "Started: " & startTime & vbcrlf & _
  468.     "Lowest Bank Roll: " & lowBankRoll & vbcrlf & _
  469.     "Highest Bank Roll: " & highBankRoll & vbcrlf & _
  470.     "Ending Bank Roll: " & bankRoll & vbcrlf & _
  471.     "Total Hands Played: " & numHandsPlayed & vbcrlf & _
  472.     "Total Wagers: " & wagers & vbcrlf & _
  473.     "Average Wager: " & Round(wagers / numHandsPlayed, 2) & vbcrlf & _
  474.     "Advantage: " & Round(bankRoll / wagers * 100, 4) & vbcrlf & _
  475.     "Ended: " & endTime & vbcrlf & _
  476.     "Elapsed Time in Minutes: " & DateDiff("n", startTime, endTime)
  477.  
  478.  
  479.  
  480.  
  481. Sub InitializeDecks(numOfDecks)
  482.     Dim i, j
  483.  
  484.     Redim Decks(52 * numOfDecks - 1, 1)
  485.  
  486.     For i = 1 To numOfDecks
  487.         For j = 0 To 51
  488.             Decks((i - 1) * 52 + j, 0) = StandardDeck(j, 0)
  489.             Decks((i - 1) * 52 + j, 1) = StandardDeck(j, 1)
  490.         Next
  491.     Next
  492. End Sub
  493.  
  494. Sub ShuffleDecks()
  495.     Dim i, j, value, suit, x
  496.  
  497.     Randomize
  498.  
  499.     ' Fisher Yates Shuffling Algorithm
  500.     x = UBound(Decks) - 1
  501.     For i = 0 To x
  502.         j = Int(Rnd() * (x - i + 2)) + i
  503.         value = Decks(j, 0)
  504.         suit = Decks(j, 1)
  505.         Decks(j, 0) = Decks(i, 0)
  506.         Decks(j, 1) = Decks(i, 1)
  507.         Decks(i, 0) = value
  508.         Decks(i, 1) = suit
  509.     Next
  510. End Sub
  511.  
  512. Sub Initialize()
  513.     startTime = Now()
  514.     bankRoll = 0
  515.     wagers = 0
  516.     lowBankRoll = 0
  517.     highBankRoll = 0
  518.     numHandsPlayed = 0
  519.  
  520.     CountValues(2) = 1
  521.     CountValues(3) = 1
  522.     CountValues(4) = 1
  523.     CountValues(5) = 1
  524.     CountValues(6) = 1
  525.     CountValues(7) = 1
  526.     CountValues(8) = 0
  527.     CountValues(9) = 0
  528.     CountValues(10) = -1
  529.     CountValues(1) = -1
  530.  
  531.     BettingRamp(0, 0) = 1
  532.     BettingRamp(0, 1) = 2
  533.     BettingRamp(1, 0) = 2
  534.     BettingRamp(1, 1) = 3
  535.     BettingRamp(2, 0) = 3
  536.     BettingRamp(2, 1) = 5
  537.     BettingRamp(3, 0) = 4
  538.     BettingRamp(3, 1) = 6
  539.  
  540.     Indexes(0, 0) = 0
  541.     Indexes(0, 1) = 16
  542.     Indexes(0, 2) = 10
  543.     Indexes(0, 3) = "S"
  544.  
  545.     Indexes(1, 0) = 4
  546.     Indexes(1, 1) = 15
  547.     Indexes(1, 2) = 10
  548.     Indexes(1, 3) = "S"
  549.  
  550.     Indexes(2, 0) = 4
  551.     Indexes(2, 1) = 12
  552.     Indexes(2, 2) = 2
  553.     Indexes(2, 3) = "S"
  554.  
  555.     Indexes(3, 0) = 4
  556.     Indexes(3, 1) = 12
  557.     Indexes(3, 2) = 3
  558.     Indexes(3, 3) = "S"
  559.  
  560.     Indexes(4, 0) = 4
  561.     Indexes(4, 1) = 9
  562.     Indexes(4, 2) = 7
  563.     Indexes(4, 3) = "DH"
  564.  
  565.     Indexes(5, 0) = 4
  566.     Indexes(5, 1) = 8
  567.     Indexes(5, 2) = 6
  568.     Indexes(5, 3) = "DH"
  569.  
  570.     Indexes(6, 0) = 4
  571.     Indexes(6, 1) = 8
  572.     Indexes(6, 2) = 5
  573.     Indexes(6, 3) = "DH"
  574.  
  575.     Indexes(7, 0) = 4
  576.     Indexes(7, 1) = 10
  577.     Indexes(7, 2) = 10
  578.     Indexes(7, 3) = "DH"
  579.  
  580.     Indexes(8, 0) = 4
  581.     Indexes(8, 1) = 10
  582.     Indexes(8, 2) = 1
  583.     Indexes(8, 3) = "DH"
  584.  
  585.     StandardDeck(0, 0) = 1
  586.     StandardDeck(0, 1) = "Ace of Diamonds"
  587.     StandardDeck(1, 0) = 2
  588.     StandardDeck(1, 1) = " of Diamonds"
  589.     StandardDeck(2, 0) = 3
  590.     StandardDeck(2, 1) = " of Diamonds"
  591.     StandardDeck(3, 0) = 4
  592.     StandardDeck(3, 1) = " of Diamonds"
  593.     StandardDeck(4, 0) = 5
  594.     StandardDeck(4, 1) = " of Diamonds"
  595.     StandardDeck(5, 0) = 6
  596.     StandardDeck(5, 1) = " of Diamonds"
  597.     StandardDeck(6, 0) = 7
  598.     StandardDeck(6, 1) = " of Diamonds"
  599.     StandardDeck(7, 0) = 8
  600.     StandardDeck(7, 1) = " of Diamonds"
  601.     StandardDeck(8, 0) = 9
  602.     StandardDeck(8, 1) = " of Diamonds"
  603.     StandardDeck(9, 0) = 10
  604.     StandardDeck(9, 1) = "Ten of Diamonds"
  605.     StandardDeck(10, 0) = 10
  606.     StandardDeck(10, 1) = "Jack of Diamonds"
  607.     StandardDeck(11, 0) = 10
  608.     StandardDeck(11, 1) = "Queen of Diamonds"
  609.     StandardDeck(12, 0) = 10
  610.     StandardDeck(12, 1) = "King of Diamonds"
  611.     StandardDeck(13, 0) = 1
  612.     StandardDeck(13, 1) = "Ace of Clubs"
  613.     StandardDeck(14, 0) = 2
  614.     StandardDeck(14, 1) = " of Clubs"
  615.     StandardDeck(15, 0) = 3
  616.     StandardDeck(15, 1) = " of Clubs"
  617.     StandardDeck(16, 0) = 4
  618.     StandardDeck(16, 1) = " of Clubs"
  619.     StandardDeck(17, 0) = 5
  620.     StandardDeck(17, 1) = " of Clubs"
  621.     StandardDeck(18, 0) = 6
  622.     StandardDeck(18, 1) = " of Clubs"
  623.     StandardDeck(19, 0) = 7
  624.     StandardDeck(19, 1) = " of Clubs"
  625.     StandardDeck(20, 0) = 8
  626.     StandardDeck(20, 1) = " of Clubs"
  627.     StandardDeck(21, 0) = 9
  628.     StandardDeck(21, 1) = " of Clubs"
  629.     StandardDeck(22, 0) = 10
  630.     StandardDeck(22, 1) = "Ten of Clubs"
  631.     StandardDeck(23, 0) = 10
  632.     StandardDeck(23, 1) = "Jack of Clubs"
  633.     StandardDeck(24, 0) = 10
  634.     StandardDeck(24, 1) = "Queen of Clubs"
  635.     StandardDeck(25, 0) = 10
  636.     StandardDeck(25, 1) = "King of Clubs"
  637.     StandardDeck(26, 0) = 1
  638.     StandardDeck(26, 1) = "Ace of Hearts"
  639.     StandardDeck(27, 0) = 2
  640.     StandardDeck(27, 1) = " of Hearts"
  641.     StandardDeck(28, 0) = 3
  642.     StandardDeck(28, 1) = " of Hearts"
  643.     StandardDeck(29, 0) = 4
  644.     StandardDeck(29, 1) = " of Hearts"
  645.     StandardDeck(30, 0) = 5
  646.     StandardDeck(30, 1) = " of Hearts"
  647.     StandardDeck(31, 0) = 6
  648.     StandardDeck(31, 1) = " of Hearts"
  649.     StandardDeck(32, 0) = 7
  650.     StandardDeck(32, 1) = " of Hearts"
  651.     StandardDeck(33, 0) = 8
  652.     StandardDeck(33, 1) = " of Hearts"
  653.     StandardDeck(34, 0) = 9
  654.     StandardDeck(34, 1) = " of Hearts"
  655.     StandardDeck(35, 0) = 10
  656.     StandardDeck(35, 1) = "Ten of Hearts"
  657.     StandardDeck(36, 0) = 10
  658.     StandardDeck(36, 1) = "Jack of Hearts"
  659.     StandardDeck(37, 0) = 10
  660.     StandardDeck(37, 1) = "Queen of Hearts"
  661.     StandardDeck(38, 0) = 10
  662.     StandardDeck(38, 1) = "King of Hearts"
  663.     StandardDeck(39, 0) = 1
  664.     StandardDeck(39, 1) = "Ace of Spades"
  665.     StandardDeck(40, 0) = 2
  666.     StandardDeck(40, 1) = " of Spades"
  667.     StandardDeck(41, 0) = 3
  668.     StandardDeck(41, 1) = " of Spades"
  669.     StandardDeck(42, 0) = 4
  670.     StandardDeck(42, 1) = " of Spades"
  671.     StandardDeck(43, 0) = 5
  672.     StandardDeck(43, 1) = " of Spades"
  673.     StandardDeck(44, 0) = 6
  674.     StandardDeck(44, 1) = " of Spades"
  675.     StandardDeck(45, 0) = 7
  676.     StandardDeck(45, 1) = " of Spades"
  677.     StandardDeck(46, 0) = 8
  678.     StandardDeck(46, 1) = " of Spades"
  679.     StandardDeck(47, 0) = 9
  680.     StandardDeck(47, 1) = " of Spades"
  681.     StandardDeck(48, 0) = 10
  682.     StandardDeck(48, 1) = "Ten of Spades"
  683.     StandardDeck(49, 0) = 10
  684.     StandardDeck(49, 1) = "Jack of Spades"
  685.     StandardDeck(50, 0) = 10
  686.     StandardDeck(50, 1) = "Queen of Spades"
  687.     StandardDeck(51, 0) = 10
  688.     StandardDeck(51, 1) = "King of Spades"
  689.  
  690.     HardStrategy(2, 2) = "H"
  691.     HardStrategy(2, 3) = "H"
  692.     HardStrategy(2, 4) = "H"
  693.     HardStrategy(2, 5) = "H"
  694.     HardStrategy(2, 6) = "H"
  695.     HardStrategy(2, 7) = "H"
  696.     HardStrategy(2, 8) = "H"
  697.     HardStrategy(2, 9) = "H"
  698.     HardStrategy(2, 10) = "H"
  699.     HardStrategy(2, 1) = "H"
  700.  
  701.     HardStrategy(4, 2) = "H"
  702.     HardStrategy(4, 3) = "H"
  703.     HardStrategy(4, 4) = "H"
  704.     HardStrategy(4, 5) = "H"
  705.     HardStrategy(4, 6) = "H"
  706.     HardStrategy(4, 7) = "H"
  707.     HardStrategy(4, 8) = "H"
  708.     HardStrategy(4, 9) = "H"
  709.     HardStrategy(4, 10) = "H"
  710.     HardStrategy(4, 1) = "H"
  711.  
  712.     HardStrategy(5, 2) = "H"
  713.     HardStrategy(5, 3) = "H"
  714.     HardStrategy(5, 4) = "H"
  715.     HardStrategy(5, 5) = "H"
  716.     HardStrategy(5, 6) = "H"
  717.     HardStrategy(5, 7) = "H"
  718.     HardStrategy(5, 8) = "H"
  719.     HardStrategy(5, 9) = "H"
  720.     HardStrategy(5, 10) = "H"
  721.     HardStrategy(5, 1) = "H"
  722.  
  723.     HardStrategy(6, 2) = "H"
  724.     HardStrategy(6, 3) = "H"
  725.     HardStrategy(6, 4) = "H"
  726.     HardStrategy(6, 5) = "H"
  727.     HardStrategy(6, 6) = "H"
  728.     HardStrategy(6, 7) = "H"
  729.     HardStrategy(6, 8) = "H"
  730.     HardStrategy(6, 9) = "H"
  731.     HardStrategy(6, 10) = "H"
  732.     HardStrategy(6, 1) = "H"
  733.  
  734.     HardStrategy(7, 2) = "H"
  735.     HardStrategy(7, 3) = "H"
  736.     HardStrategy(7, 4) = "H"
  737.     HardStrategy(7, 5) = "H"
  738.     HardStrategy(7, 6) = "H"
  739.     HardStrategy(7, 7) = "H"
  740.     HardStrategy(7, 8) = "H"
  741.     HardStrategy(7, 9) = "H"
  742.     HardStrategy(7, 10) = "H"
  743.     HardStrategy(7, 1) = "H"
  744.  
  745.     HardStrategy(8, 2) = "H"
  746.     HardStrategy(8, 3) = "H"
  747.     HardStrategy(8, 4) = "H"
  748.     HardStrategy(8, 5) = "H"
  749.     HardStrategy(8, 6) = "H"
  750.     HardStrategy(8, 7) = "H"
  751.     HardStrategy(8, 8) = "H"
  752.     HardStrategy(8, 9) = "H"
  753.     HardStrategy(8, 10) = "H"
  754.     HardStrategy(8, 1) = "H"
  755.  
  756.     HardStrategy(9, 2) = "DH"
  757.     HardStrategy(9, 3) = "DH"
  758.     HardStrategy(9, 4) = "DH"
  759.     HardStrategy(9, 5) = "DH"
  760.     HardStrategy(9, 6) = "DH"
  761.     HardStrategy(9, 7) = "H"
  762.     HardStrategy(9, 8) = "H"
  763.     HardStrategy(9, 9) = "H"
  764.     HardStrategy(9, 10) = "H"
  765.     HardStrategy(9, 1) = "H"
  766.  
  767.     HardStrategy(10, 2) = "DH"
  768.     HardStrategy(10, 3) = "DH"
  769.     HardStrategy(10, 4) = "DH"
  770.     HardStrategy(10, 5) = "DH"
  771.     HardStrategy(10, 6) = "DH"
  772.     HardStrategy(10, 7) = "DH"
  773.     HardStrategy(10, 8) = "DH"
  774.     HardStrategy(10, 9) = "DH"
  775.     HardStrategy(10, 10) = "H"
  776.     HardStrategy(10, 1) = "H"
  777.  
  778.     HardStrategy(11, 2) = "DH"
  779.     HardStrategy(11, 3) = "DH"
  780.     HardStrategy(11, 4) = "DH"
  781.     HardStrategy(11, 5) = "DH"
  782.     HardStrategy(11, 6) = "DH"
  783.     HardStrategy(11, 7) = "DH"
  784.     HardStrategy(11, 8) = "DH"
  785.     HardStrategy(11, 9) = "DH"
  786.     HardStrategy(11, 10) = "DH"
  787.     HardStrategy(11, 1) = "DH"
  788.  
  789.     HardStrategy(12, 2) = "H"
  790.     HardStrategy(12, 3) = "H"
  791.     HardStrategy(12, 4) = "S"
  792.     HardStrategy(12, 5) = "S"
  793.     HardStrategy(12, 6) = "S"
  794.     HardStrategy(12, 7) = "H"
  795.     HardStrategy(12, 8) = "H"
  796.     HardStrategy(12, 9) = "H"
  797.     HardStrategy(12, 10) = "H"
  798.     HardStrategy(12, 1) = "H"
  799.  
  800.     HardStrategy(13, 2) = "S"
  801.     HardStrategy(13, 3) = "S"
  802.     HardStrategy(13, 4) = "S"
  803.     HardStrategy(13, 5) = "S"
  804.     HardStrategy(13, 6) = "S"
  805.     HardStrategy(13, 7) = "H"
  806.     HardStrategy(13, 8) = "H"
  807.     HardStrategy(13, 9) = "H"
  808.     HardStrategy(13, 10) = "H"
  809.     HardStrategy(13, 1) = "H"
  810.  
  811.     HardStrategy(14, 2) = "S"
  812.     HardStrategy(14, 3) = "S"
  813.     HardStrategy(14, 4) = "S"
  814.     HardStrategy(14, 5) = "S"
  815.     HardStrategy(14, 6) = "S"
  816.     HardStrategy(14, 7) = "H"
  817.     HardStrategy(14, 8) = "H"
  818.     HardStrategy(14, 9) = "H"
  819.     HardStrategy(14, 10) = "H"
  820.     HardStrategy(14, 1) = "H"
  821.  
  822.     HardStrategy(15, 2) = "S"
  823.     HardStrategy(15, 3) = "S"
  824.     HardStrategy(15, 4) = "S"
  825.     HardStrategy(15, 5) = "S"
  826.     HardStrategy(15, 6) = "S"
  827.     HardStrategy(15, 7) = "H"
  828.     HardStrategy(15, 8) = "H"
  829.     HardStrategy(15, 9) = "H"
  830.     HardStrategy(15, 10) = "RH"
  831.     HardStrategy(15, 1) = "RH"
  832.  
  833.     HardStrategy(16, 2) = "S"
  834.     HardStrategy(16, 3) = "S"
  835.     HardStrategy(16, 4) = "S"
  836.     HardStrategy(16, 5) = "S"
  837.     HardStrategy(16, 6) = "S"
  838.     HardStrategy(16, 7) = "H"
  839.     HardStrategy(16, 8) = "H"
  840.     HardStrategy(16, 9) = "H"
  841.     HardStrategy(16, 10) = "RH"
  842.     HardStrategy(16, 1) = "RH"
  843.  
  844.     HardStrategy(17, 2) = "S"
  845.     HardStrategy(17, 3) = "S"
  846.     HardStrategy(17, 4) = "S"
  847.     HardStrategy(17, 5) = "S"
  848.     HardStrategy(17, 6) = "S"
  849.     HardStrategy(17, 7) = "S"
  850.     HardStrategy(17, 8) = "S"
  851.     HardStrategy(17, 9) = "S"
  852.     HardStrategy(17, 10) = "S"
  853.     HardStrategy(17, 1) = "RS"
  854.  
  855.     HardStrategy(18, 2) = "S"
  856.     HardStrategy(18, 3) = "S"
  857.     HardStrategy(18, 4) = "S"
  858.     HardStrategy(18, 5) = "S"
  859.     HardStrategy(18, 6) = "S"
  860.     HardStrategy(18, 7) = "S"
  861.     HardStrategy(18, 8) = "S"
  862.     HardStrategy(18, 9) = "S"
  863.     HardStrategy(18, 10) = "S"
  864.     HardStrategy(18, 1) = "S"
  865.  
  866.     HardStrategy(19, 2) = "S"
  867.     HardStrategy(19, 3) = "S"
  868.     HardStrategy(19, 4) = "S"
  869.     HardStrategy(19, 5) = "S"
  870.     HardStrategy(19, 6) = "S"
  871.     HardStrategy(19, 7) = "S"
  872.     HardStrategy(19, 8) = "S"
  873.     HardStrategy(19, 9) = "S"
  874.     HardStrategy(19, 10) = "S"
  875.     HardStrategy(19, 1) = "S"
  876.  
  877.     HardStrategy(20, 2) = "S"
  878.     HardStrategy(20, 3) = "S"
  879.     HardStrategy(20, 4) = "S"
  880.     HardStrategy(20, 5) = "S"
  881.     HardStrategy(20, 6) = "S"
  882.     HardStrategy(20, 7) = "S"
  883.     HardStrategy(20, 8) = "S"
  884.     HardStrategy(20, 9) = "S"
  885.     HardStrategy(20, 10) = "S"
  886.     HardStrategy(20, 1) = "S"
  887.  
  888.     HardStrategy(21, 2) = "S"
  889.     HardStrategy(21, 3) = "S"
  890.     HardStrategy(21, 4) = "S"
  891.     HardStrategy(21, 5) = "S"
  892.     HardStrategy(21, 6) = "S"
  893.     HardStrategy(21, 7) = "S"
  894.     HardStrategy(21, 8) = "S"
  895.     HardStrategy(21, 9) = "S"
  896.     HardStrategy(21, 10) = "S"
  897.     HardStrategy(21, 1) = "S"
  898.  
  899.     SoftStrategy(12, 2) = "H"
  900.     SoftStrategy(12, 3) = "H"
  901.     SoftStrategy(12, 4) = "H"
  902.     SoftStrategy(12, 5) = "H"
  903.     SoftStrategy(12, 6) = "H"
  904.     SoftStrategy(12, 7) = "H"
  905.     SoftStrategy(12, 8) = "H"
  906.     SoftStrategy(12, 9) = "H"
  907.     SoftStrategy(12, 10) = "H"
  908.     SoftStrategy(12, 1) = "H"
  909.  
  910.     SoftStrategy(13, 2) = "H"
  911.     SoftStrategy(13, 3) = "H"
  912.     SoftStrategy(13, 4) = "H"
  913.     SoftStrategy(13, 5) = "DH"
  914.     SoftStrategy(13, 6) = "DH"
  915.     SoftStrategy(13, 7) = "H"
  916.     SoftStrategy(13, 8) = "H"
  917.     SoftStrategy(13, 9) = "H"
  918.     SoftStrategy(13, 10) = "H"
  919.     SoftStrategy(13, 1) = "H"
  920.  
  921.     SoftStrategy(14, 2) = "H"
  922.     SoftStrategy(14, 3) = "H"
  923.     SoftStrategy(14, 4) = "DH"
  924.     SoftStrategy(14, 5) = "DH"
  925.     SoftStrategy(14, 6) = "DH"
  926.     SoftStrategy(14, 7) = "H"
  927.     SoftStrategy(14, 8) = "H"
  928.     SoftStrategy(14, 9) = "H"
  929.     SoftStrategy(14, 10) = "H"
  930.     SoftStrategy(14, 1) = "H"
  931.  
  932.     SoftStrategy(15, 2) = "H"
  933.     SoftStrategy(15, 3) = "H"
  934.     SoftStrategy(15, 4) = "DH"
  935.     SoftStrategy(15, 5) = "DH"
  936.     SoftStrategy(15, 6) = "DH"
  937.     SoftStrategy(15, 7) = "H"
  938.     SoftStrategy(15, 8) = "H"
  939.     SoftStrategy(15, 9) = "H"
  940.     SoftStrategy(15, 10) = "H"
  941.     SoftStrategy(15, 1) = "H"
  942.  
  943.     SoftStrategy(16, 2) = "H"
  944.     SoftStrategy(16, 3) = "H"
  945.     SoftStrategy(16, 4) = "DH"
  946.     SoftStrategy(16, 5) = "DH"
  947.     SoftStrategy(16, 6) = "DH"
  948.     SoftStrategy(16, 7) = "H"
  949.     SoftStrategy(16, 8) = "H"
  950.     SoftStrategy(16, 9) = "H"
  951.     SoftStrategy(16, 10) = "H"
  952.     SoftStrategy(16, 1) = "H"
  953.  
  954.     SoftStrategy(17, 2) = "H"
  955.     SoftStrategy(17, 3) = "DH"
  956.     SoftStrategy(17, 4) = "DH"
  957.     SoftStrategy(17, 5) = "DH"
  958.     SoftStrategy(17, 6) = "DH"
  959.     SoftStrategy(17, 7) = "H"
  960.     SoftStrategy(17, 8) = "H"
  961.     SoftStrategy(17, 9) = "H"
  962.     SoftStrategy(17, 10) = "H"
  963.     SoftStrategy(17, 1) = "H"
  964.  
  965.     SoftStrategy(18, 2) = "DS"
  966.     SoftStrategy(18, 3) = "DS"
  967.     SoftStrategy(18, 4) = "DS"
  968.     SoftStrategy(18, 5) = "DS"
  969.     SoftStrategy(18, 6) = "DS"
  970.     SoftStrategy(18, 7) = "S"
  971.     SoftStrategy(18, 8) = "S"
  972.     SoftStrategy(18, 9) = "H"
  973.     SoftStrategy(18, 10) = "H"
  974.     SoftStrategy(18, 1) = "H"
  975.  
  976.     SoftStrategy(19, 2) = "S"
  977.     SoftStrategy(19, 3) = "S"
  978.     SoftStrategy(19, 4) = "S"
  979.     SoftStrategy(19, 5) = "S"
  980.     SoftStrategy(19, 6) = "DS"
  981.     SoftStrategy(19, 7) = "S"
  982.     SoftStrategy(19, 8) = "S"
  983.     SoftStrategy(19, 9) = "S"
  984.     SoftStrategy(19, 10) = "S"
  985.     SoftStrategy(19, 1) = "S"
  986.  
  987.     SoftStrategy(20, 2) = "S"
  988.     SoftStrategy(20, 3) = "S"
  989.     SoftStrategy(20, 4) = "S"
  990.     SoftStrategy(20, 5) = "S"
  991.     SoftStrategy(20, 6) = "S"
  992.     SoftStrategy(20, 7) = "S"
  993.     SoftStrategy(20, 8) = "S"
  994.     SoftStrategy(20, 9) = "S"
  995.     SoftStrategy(20, 10) = "S"
  996.     SoftStrategy(20, 1) = "S"
  997.  
  998.     SoftStrategy(21, 2) = "S"
  999.     SoftStrategy(21, 3) = "S"
  1000.     SoftStrategy(21, 4) = "S"
  1001.     SoftStrategy(21, 5) = "S"
  1002.     SoftStrategy(21, 6) = "S"
  1003.     SoftStrategy(21, 7) = "S"
  1004.     SoftStrategy(21, 8) = "S"
  1005.     SoftStrategy(21, 9) = "S"
  1006.     SoftStrategy(21, 10) = "S"
  1007.     SoftStrategy(21, 1) = "S"
  1008.  
  1009.     SplitStrategy(2, 2) = "H"
  1010.     SplitStrategy(2, 3) = "H"
  1011.     SplitStrategy(2, 4) = "P"
  1012.     SplitStrategy(2, 5) = "P"
  1013.     SplitStrategy(2, 6) = "P"
  1014.     SplitStrategy(2, 7) = "P"
  1015.     SplitStrategy(2, 8) = "H"
  1016.     SplitStrategy(2, 9) = "H"
  1017.     SplitStrategy(2, 10) = "H"
  1018.     SplitStrategy(2, 1) = "H"
  1019.  
  1020.     SplitStrategy(3, 2) = "H"
  1021.     SplitStrategy(3, 3) = "H"
  1022.     SplitStrategy(3, 4) = "P"
  1023.     SplitStrategy(3, 5) = "P"
  1024.     SplitStrategy(3, 6) = "P"
  1025.     SplitStrategy(3, 7) = "P"
  1026.     SplitStrategy(3, 8) = "H"
  1027.     SplitStrategy(3, 9) = "H"
  1028.     SplitStrategy(3, 10) = "H"
  1029.     SplitStrategy(3, 1) = "H"
  1030.  
  1031.     SplitStrategy(4, 2) = "H"
  1032.     SplitStrategy(4, 3) = "H"
  1033.     SplitStrategy(4, 4) = "H"
  1034.     SplitStrategy(4, 5) = "H"
  1035.     SplitStrategy(4, 6) = "H"
  1036.     SplitStrategy(4, 7) = "H"
  1037.     SplitStrategy(4, 8) = "H"
  1038.     SplitStrategy(4, 9) = "H"
  1039.     SplitStrategy(4, 10) = "H"
  1040.     SplitStrategy(4, 1) = "H"
  1041.  
  1042.     SplitStrategy(5, 2) = "DH"
  1043.     SplitStrategy(5, 3) = "DH"
  1044.     SplitStrategy(5, 4) = "DH"
  1045.     SplitStrategy(5, 5) = "DH"
  1046.     SplitStrategy(5, 6) = "DH"
  1047.     SplitStrategy(5, 7) = "DH"
  1048.     SplitStrategy(5, 8) = "DH"
  1049.     SplitStrategy(5, 9) = "DH"
  1050.     SplitStrategy(5, 10) = "H"
  1051.     SplitStrategy(5, 1) = "H"
  1052.  
  1053.     SplitStrategy(6, 2) = "P"
  1054.     SplitStrategy(6, 3) = "P"
  1055.     SplitStrategy(6, 4) = "P"
  1056.     SplitStrategy(6, 5) = "P"
  1057.     SplitStrategy(6, 6) = "P"
  1058.     SplitStrategy(6, 7) = "H"
  1059.     SplitStrategy(6, 8) = "H"
  1060.     SplitStrategy(6, 9) = "H"
  1061.     SplitStrategy(6, 10) = "H"
  1062.     SplitStrategy(6, 1) = "H"
  1063.  
  1064.     SplitStrategy(7, 2) = "P"
  1065.     SplitStrategy(7, 3) = "P"
  1066.     SplitStrategy(7, 4) = "P"
  1067.     SplitStrategy(7, 5) = "P"
  1068.     SplitStrategy(7, 6) = "P"
  1069.     SplitStrategy(7, 7) = "P"
  1070.     SplitStrategy(7, 8) = "H"
  1071.     SplitStrategy(7, 9) = "H"
  1072.     SplitStrategy(7, 10) = "H"
  1073.     SplitStrategy(7, 1) = "H"
  1074.  
  1075.     SplitStrategy(8, 2) = "P"
  1076.     SplitStrategy(8, 3) = "P"
  1077.     SplitStrategy(8, 4) = "P"
  1078.     SplitStrategy(8, 5) = "P"
  1079.     SplitStrategy(8, 6) = "P"
  1080.     SplitStrategy(8, 7) = "P"
  1081.     SplitStrategy(8, 8) = "P"
  1082.     SplitStrategy(8, 9) = "P"
  1083.     SplitStrategy(8, 10) = "P"
  1084.     SplitStrategy(8, 1) = "RP"
  1085.  
  1086.     SplitStrategy(9, 2) = "P"
  1087.     SplitStrategy(9, 3) = "P"
  1088.     SplitStrategy(9, 4) = "P"
  1089.     SplitStrategy(9, 5) = "P"
  1090.     SplitStrategy(9, 6) = "P"
  1091.     SplitStrategy(9, 7) = "S"
  1092.     SplitStrategy(9, 8) = "P"
  1093.     SplitStrategy(9, 9) = "P"
  1094.     SplitStrategy(9, 10) = "S"
  1095.     SplitStrategy(9, 1) = "S"
  1096.  
  1097.     SplitStrategy(10, 2) = "S"
  1098.     SplitStrategy(10, 3) = "S"
  1099.     SplitStrategy(10, 4) = "S"
  1100.     SplitStrategy(10, 5) = "S"
  1101.     SplitStrategy(10, 6) = "S"
  1102.     SplitStrategy(10, 7) = "S"
  1103.     SplitStrategy(10, 8) = "S"
  1104.     SplitStrategy(10, 9) = "S"
  1105.     SplitStrategy(10, 10) = "S"
  1106.     SplitStrategy(10, 1) = "S"
  1107.  
  1108.     SplitStrategy(1, 2) = "P"
  1109.     SplitStrategy(1, 3) = "P"
  1110.     SplitStrategy(1, 4) = "P"
  1111.     SplitStrategy(1, 5) = "P"
  1112.     SplitStrategy(1, 6) = "P"
  1113.     SplitStrategy(1, 7) = "P"
  1114.     SplitStrategy(1, 8) = "P"
  1115.     SplitStrategy(1, 9) = "P"
  1116.     SplitStrategy(1, 10) = "P"
  1117.     SplitStrategy(1, 1) = "P"
  1118. End Sub
Nov 1 '14 #1
2 19304
twinnyfo
3,653 Recognized Expert Moderator Specialist
Rabbit,

Thanks for the code. I'll run through it just to see all the workings. I'm no gambler, but the science behind cards interests me. I appreciate the time you took to put this together!
Nov 3 '14 #2
Rabbit
12,516 Recognized Expert Moderator MVP
No problem twinnyfo, it was more to satisfy my own curiosity. I'm no card counting expert so I've been using a simplified version of an already simple counting algorithm. I was just curious if using such a simple count actually gained me any benefit so I figured I would simulate millions of games to find out.
Nov 3 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2296
by: Alex Vinokur | last post by:
C++ Simulator of a Universal Turing Machine can be downloaded at : * http://alexvn.freeservers.com/s1/utm.html * http://sourceforge.net/projects/turing-machine/ The program simulates a Universal Turing Machine (UTM). The UTM used in the Simulator is three-tape Turing Machine: * Tape#0 contains transition table and initial instantaneous description of a Particular Turing Machine (TM);
9
2622
by: Milk | last post by:
Hi all, Can anyone help me to do this Question. Coz this is my first time study C++ language and my lecture want me to do this kind of program, i really don't have any ideal pls help me here is the Question:: Improve the following (badly written) matrix multiplicationprogram and translate it into MIPs assembly language then assemble into machine language (hexadecimal representation). You may use a compiler to produce an assembly
3
2672
by: slyphiad | last post by:
Here's the problem that i got... I'm trying to create a blackjack game. Here, I'm trying to create 2 blackjack games. A game with bet and without bet. So basically what i did, was create 2 class: a blackjack class and a bet class. How can i access the bet class from the blackjack class? I tried using the code below in one of the function in blackjack. Bet betgame;
0
1597
by: SatishPasala | last post by:
Hi I am developing a Windows Mobile application. I want Visual Studio to use Palm Simulator to display the application. Now it is pointing to Default Simulator. I downloaded the Palm Simulator. I need to add it to Visual Studio. Can some one help me to add the simulator?
0
4065
by: Killingkids | last post by:
hello, everyone...im facing a big problem in my final year project, hope that u all can help me solve the problem ... i was doing a mobile web application which enable student to check the college information through mobile, however i just use simulator to test my system... one of modules or function was enable the student to downloads some notes which in txt file format through mobile.Hence, i tested using IE,it does not appear any problem, i...
0
1694
by: Killingkids | last post by:
hello, everyone...im facing a big problem in my final year project, hope that u all can help me solve the problem ... i was doing a mobile web application which enable student to check the college information through mobile, however i just use simulator to test my system... one of modules or function was enable the student to downloads some notes which in txt file format through mobile.Hence, i tested using IE,it does not appear any problem, i...
12
2075
by: karoly.kiripolszky | last post by:
Helo ppl! At the job I was given the task to make a script to analyze C++ code based on concepts my boss had. To do this I needed to represent C++ code structure in Python somehow. I read the docs for Yapps, pyparsing and other stuff like those, then I came up with a very simple idea. I realized that bracketed code is almost like a Python list, except I have to replace curly brackets with squared ones and surround the remaining stuff...
3
4731
by: DanielJohnson | last post by:
I was wondering if anyblody can suggest me a network simulator written in python in which I can add on my own code and extend its functionality. I am looking for a simulator which will simualte TCP, UDP, RTP and most networking protocol. The learning curve for ns2 and other simulator is too high for me at this time and thats why I am considering Python for it. Every help will be appreciated.
30
9101
by: imran akhtar | last post by:
i have a balckjack code, which does not seem to run, in python, it comes up with syntax error, i have try sortng it out. does not seem to work. below is my code, if anyone can work out wht wrong with it. that will be great. thereis an attched file, to see the code more cleaer. from random import choice as randomcards def total(hand): # how many aces in the hand aces = hand.count(11) # to complicate things a little the...
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.