Need logic help (BlackJack)

I don’t think there should be a tie. The dealer should always pick a card until they either win or loose. I you have trouble with your code, then you should go back before you made the changes and just make minor changes until you get it to work the way you want.

@kendog400 My suggestion is to re-edit your previous discussions and remove all the code and replace it with the text “Updated code below” and repost your completed finished code. That would remove all confusion about what’s good and what’s not.

@kendog400 When you put “ “ around a word, you print (text) that word. When you don’t put “ “ around a word, you print (text) the value of that word.

Thanks !

@kendog400 If you want to text a word and it’s value then do

text("Score  "..score,WIDTH/2,HEIGHT/2)

@kendog400 Look at this and see if it works for you. I dont know how you have your cards defined so you have to convert this code to work with your cards.

function getScore(cards)
    score=0
    aces=0
    for loop thru cards (player or dealer)
        if card == ace then
            aces = aces + 1
            score = score + 1
        elseif card == jack or queen or king then
            score = score + 10
        else
            score = score + card value  (2 thru 10)
        end
        if aces > 0 and score < 12 then
            score = score + 10
        end
    end
end