21: Hit Me (Stage 1)

21: Hit Me (Stage 1)

else if(action=='Hit Me'){
 document.getElementById('gameStatus').innerHTML = "Game In Progress!";
    
 if(current_score > 21){
   alert('You have scored higher than 21. Click OK to re-shuffle the deck and start over.');
   twenty1('Shuffle');
  }
  else{
   // choose a random stack
   suit_chosen = Suits[Math.floor(Math.random()*4)];
       
   if(suit_chosen=="Clubs"){
    items_left_in_suit = Clubs.length;
   }
   else if(suit_chosen=="Hearts"){
    items_left_in_suit = Hearts.length;
   }
   else if(suit_chosen=="Spades"){
    items_left_in_suit = Spades.length;
   }
   else if(suit_chosen=="Diamonds"){
    items_left_in_suit = Spades.length;
   }
   else{
    document.getElementById('gameStatus').innerHTML ='Invalid Suit Chosen - We Will Re-deal!';
    twenty1('Hit Me');
  }
}
Comments are closed.