function createGame() {
  let deck = createDeck();
  let result = createCardHolder(deck);
  // TODO: IMPROVE ON THIS
  const player = { hand: [], handValue: 0 };
  player.hand = result.hand;
  player.handValue = result.handValue;
  deck = result.newDeck;
  //-----------------------------------
  result = createCardHolder(deck);
  // TODO: IMPROVE ON THIS
  const dealer = { hand: [], handValue: 0 };
  dealer.hand = result.hand;
  dealer.handValue = result.handValue;
  deck = result.newDeck;
  //-----------------------------------
  const winningMessage = compareHands(player, dealer);
  printGame(player, dealer, winningMessage);
}
/**
 * Creates the game and executes the logic
 */
Creates the game and executes the logic
Creates the game and executes the logic
function createGame() {
  let deck = createDeck();
  let result = createCardHolder(deck);
  const player = { hand: [], handValue: 0 };
  player.hand = result.hand;
  player.handValue = result.handValue;
  deck = result.newDeck;
  result = createCardHolder(deck);
  const dealer = { hand: [], handValue: 0 };
  dealer.hand = result.hand;
  dealer.handValue = result.handValue;
  deck = result.newDeck;
  const winningMessage = compareHands(player, dealer);
  printGame(player, dealer, winningMessage);
}
function createGame ( ) { let deck = createDeck ( ) ; let result = createCardHolder ( deck ) ; const player = { hand : [ ] , handValue : 0 } ; player . hand = result . hand ; player . handValue = result . handValue ; deck = result . newDeck ; result = createCardHolder ( deck ) ; const dealer = { hand : [ ] , handValue : 0 } ; dealer . hand = result . hand ; dealer . handValue = result . handValue ; deck = result . newDeck ; const winningMessage = compareHands ( player , dealer ) ; printGame ( player , dealer , winningMessage ) ; }
Creates the game and executes the logic
Creates the game and executes the logic
// TODO: IMPROVE ON THIS //----------------------------------- // TODO: IMPROVE ON THIS //-----------------------------------