So I've been writing a miniature simulator the last few days. Nothing fancy, really. It's mostly a "just-for-fun" project, as well as getting better at coding in general.

1. Ace is 1 or 11. Basically, I have two arrays, dealer[x] and player[y]. Should I go through each element in the array to check if they have an Ace? Or should I have a boolean variable, like dealerHasAce or playerHasAce. If the variable is TRUE, then ace is counted as 11. If it's FALSE, ace is counted as 1 (if it has an ace). ?? Having a boolean variable would mean it doesn't have to go through each element in the array to find if there is or isn't an ace.

2. Splitting hands. Should I create player2[], player3[], player4[] arrays for this? Or should I have a single, multidimensional array? ie: player[x][y] where X is the number of hands (x = 1 means hand is not split, x = 2 means he has split once, x = 3 means he has split two times for a total of three hands, etc.), then where y is the value of the card? If multiple arrays are created, it'd seem like a sh*tstorm checking if there are any current elements in player2[], player3[], etc. Whereas in a multi-dimensional array, it could all be nested in a double loop (for i = 1 to 4 : for n = 1 to 12 : player[i][n] ...).

3. Right now, the code has 10's, J, Q, and K cards. Should I just treat all of them as a "10". Instead of saying there are 24 10's, 24 J's, 24 Q's, 24 K's,...just say there are 96 10's? On one hand, it'd make it better so it doesn't have to convert a "J" to a "10" value every time....but on the other hand, it would also allow for things like LL side-bet....although I'm not sure if I ever plan on getting this "to that level" where side-bets and other stuff is included. After all, it's more of a "just for fun" thing to do.

4. Right now it only uses basic strategy (splitting/doubling/soft-hand not included), but want to include indices in the future. Is there any "good" way of doing this? The only thing I've thought of is doing something like this:

Code:
Function playHand()

    if NOT handIsAPair Then
         indexPlay(playerTotal, upCard, TC)
    else
          doSomethingElseForDoublingDownOrSplittingOrSomething()
    end if
End Function


Function indexPlay(pTotal, up, count)


    if pTotal = 12 AND up = 2 Then
        if count > 6 Then
            stay
        else
            hit
        end if
    elseif pTotal = 12 AND up = 3 then
        if count > 3 Then
            stay
        else
            hit
        end if
    elseif pTotal = 12 AND up = 4 Then
        if count > 1 Then
            stay
        else
            hit
        end if
    elseif pTotal = 12 AND up = 5 Then
        if count > -2 Then
            stay
        else
            hit
        end if
    elseif pTotal = 12 AND up = 6 Then
        if count > -5 Then
            stay
        else
            hit
        end if
    elseif pTotal = 12 AND up = 7 Then
        if count > WHATEVER_12_V_7_INDEX_IS Then
            stay
        else
            hit
        end if
    .
    .
    .
    elseif pTotal = 13 AND up = 2 Then
        if count > -2 Then
            stay
        else
            hit
        end if
    elseif pTotal = 13 AND up = 3 Then
        if count > -4 Then
            stay
        else
            hit
        end if
    .
    .
    .
    // and so on...
    end if
End Function
Of course, I could make an array or tables or something of the indices, so instead of hard-coding the 12v2 index at +6, I could just call that something like index[1] for 12v2, index[2] could be 12v3, etc...