mirror of
https://github.com/MrEidam/Black-Jack.git
synced 2025-12-29 17:06:11 +00:00
Better Aces
This commit is contained in:
12
main.js
12
main.js
@@ -94,6 +94,18 @@ function cardsleft(){
|
||||
function addScore(num){
|
||||
playerCards.push(num);
|
||||
|
||||
//? Filters out Aces
|
||||
const withoutAces = playerCards.filter(e => e !== 'A');
|
||||
|
||||
const count = playerCards.length-withoutAces.length;
|
||||
|
||||
//? Adds the aces to the end
|
||||
for(let i=0; i<count;i++){
|
||||
withoutAces.push('A');
|
||||
}
|
||||
|
||||
playerCards = [...withoutAces];
|
||||
|
||||
score = 0;
|
||||
playerCards.forEach(e => {
|
||||
if(e === 'A'){
|
||||
|
||||
Reference in New Issue
Block a user