Someone
public text v1 · immutable function calculatePoints($hand) {
$points = 0;
$totalAces = 0;
foreach($hand as $value) {
if(is_numeric($value)) { $points += $value; }
elseif($value != "A") { $points += 10; }
else { $totalAces++; }
}
if($points > 10) { $points += $totalAces; }
else { $points += 11+($totalAces-1); }
}