Hi everyone. I’m still new to programming
I already understand the logic of the answer by using switch. I just dont understand why the cards sequence 2,3,4,5,6 should return the string “5 Bet”.
Are there any explanations? Thanks before!
Hi everyone. I’m still new to programming
I already understand the logic of the answer by using switch. I just dont understand why the cards sequence 2,3,4,5,6 should return the string “5 Bet”.
Are there any explanations? Thanks before!
Each of those cards should increase count
by 1, so count
would be 5
after all of those calls to cc
.
Hi Randell, thank you for your kind response.
Hmm, so if I start with let count = 4, and when I call the function cc(2), it will result in “5 Bet”?
I still don’t get the “sequence” part of this challenge. How can the sequence be executed if I were to play real Blackjack? My logic is when we are playing a real game with this code, each time we draw the card then it will update the “count” value. Assuming the first card is 2 and the initial count is 0, then cc(2) will be equal to “1 Bet”. How can we arrive at the “5 Bet” answer if there is only 1 round?
Thanks once again!
For the tests, the count
variable is reset to 0
each time. A round as far as the tests are concerned, is just calling the function multiple times. In the case of 5 Bet
, the following calls are made and would be considered a round
cc(2);
cc(3);
cc(4);
cc(5);
cc(6);
Ahh, I see. So “5 Bet” is the sum of those 5 cards that are made in 1 round, and not in one function. Really thankful for your explanation!
I still wonder how can we put those sequences in 1 function so it directly produce “5 Bet” answer and we don’t have to call the initial function multiple times. Can you help me with this? Thanks Randell!
Did you come up with a solution for the existing solution?