How can i make a 1 count as 11 if its best in blackjack
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Matwiz
il 24 Gen 2020
Risposto: Walter Roberson
il 24 Gen 2020
i want to create a function that optimally calculates a hand of cards according to blackjack rules
this is what i have so far, but it doesnt seem to be able to count ace as 11
does any1 know why the if sentence doesnt work or what i could do instead?
function score = blackjack(hand)
hand = [10 1]
score = sum(hand);
if score <= 11 & hand==1
score = score + 10;
end
if (score > 21)
score = 0;
end
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su String in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!