question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Counting Cards(Not Working)

See original GitHub issue

Challenge Counting Cards has an issue. User Agent is: Mozilla/5.0 (Windows NT 5.1; rv:44.0) Gecko/20100101 Firefox/44.0. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

var count = 0;
function cc(card) {
// Only change code below this line
switch (card) {
case 'J':
case 'Q':
case 'K':
case 'A':
case 10:
count--;
}
if (count < 7) {
count++;
}
if (count <= 0) {
return count + " Hold";
}else if (count > 0) {
return count + " Bet";
}
return "Change Me";
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(3); cc(9); cc('Q'); cc(8); cc('A');

It looks to me like this code works. Several users in the chat said this should work. But, I keep on getting it wrong. I believe this is a bug,

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
JBujicommented, Dec 26, 2016

Content Hidden - by mod [raisedadead]

2reactions
alistermadacommented, Mar 11, 2016

Nope, not a bug. Hint, here’s your problem:

if (count < 7) {
count++;
}

Just one thing here needs to change and your code will pass. If you compare this if statement with your switch statement you’ll see what’s wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Counting Cards At The Casino - Why It Doesn't Work Anymore
This means that after just a few hands, when you've been counting cards, they will ask you to stop and leave the premises...
Read more >
If counting cards in blackjack is so effective, why isn't ... - Quora
A basic count is not that effective. Professionals utilise knowledge of the fact that casino shuffles are not perfect, and have devised systems...
Read more >
Counting Cards not working Feb.7th 2022 - JavaScript
I know I can try with Switch but idk why my if statement is failing **Your code so far** let count = 0;...
Read more >
4 Reasons Why Counting Cards is a Waste of Time
One main reason why card counting is a waste of time is that as soon as a player gets a good read on...
Read more >
Does Card Counting Work and Other Blackjack Misconceptions
The pros at Blackjack Apprenticeship answer the age old question, "Does Card Counting Work?" Does counting cards work? Of course it does!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found