Need logic help (BlackJack)

Thank you, i’ll get right on this…

Just a quick question : Can I set a parameter watch to keep a tab on all the aces that are dealt ? Like So :
~~
function setup()
parameter.watch(“v==1”) – watch the aces
~~
or is there a better way that I dont know about ?

Something like this might work. You would need to determine where the check for ace code needs to go. The parameter ace value will show 0 unless it’s an ace.

function setup()
    parameter.watch("ace")
end

function draw()
    background(0)
    
    -- check for ace
    ace=0
    if v==1 or v==11 then
        ace=v
    end
end

THank you, I will get back to the drawing board…

@kendog400 Here’s an updated GetScore function. The print statements are there just so you can see what’s happening. I don’t know how you’re getting the card values, so I just set the deck table to some card values. You can keep changing the values in deck to try different situations.

function setup()
    score=0
    deck={3,2,1,1,2,1,1}
    for z=1,#deck do
        score=GetScore(score,deck[z])
    end
end

function GetScore(score,crd)    -- crd = value 1 thru 10 
    print("Card value = "..crd)
    if crd==1 then 
        if score<11 then 
            print("Ace value = "..11)
            score=score+11 
        else 
            print("Ace value = "..1)
            score=score+1 
        end
    else
        score=score+crd
    end
    print("Score ========= "..score)
    return score
end