The problem

Card counting is a famous example of how information changes probabilities, but most explanations are hand-wavy. Learners can't easily feel the count or see why it shifts the odds. CountSense is an educational tool (not gambling advice) that makes the idea hands-on and checkable.

What it does

  1. Running count drill. Cards appear one at a time at a speed you choose (0.3 to 1.5 s). Hi-Lo: 2-6 = +1, 7-9 = 0, 10-A = -1. A learning mode shows the count live. You enter your count and see every card's value, so you can find where you slipped.
  2. True count. Running count divided by decks left, with instant feedback and a streak. It shows why +6 with one deck left is very different from +6 with six decks left.
  3. Simulator. Plays up to 2,000,000 simulated hands in your browser for a flat bettor and for a counter (1-8 unit bet ramp, some Hi-Lo index plays, insurance at true count 3+), then charts the edge by true count and one 3,000-hand bankroll path.

What we tested and what changed

I ran 8 independent runs of 2,000,000 hands per strategy (node tests/benchmark.js). On the final rules (6 decks, 75% dealt, dealer stands on soft 17, blackjack pays 3:2, one split, double any two cards) the flat bettor averaged -0.50% per hand (about ±0.08%, 95%) and the counter +0.44% per unit wagered (about ±0.08%). The edge per hand rises with the true count, which is the mechanism behind the result.

The first test did not look like that. My first simulator had no splitting, no index plays and no insurance. Its 1M-hand run gave a flat edge of about -0.9% and a counter edge that was still negative (about -0.4%), i.e. a bet ramp alone did not beat the house. After I added splitting, a subset of Hi-Lo index plays and insurance, the flat baseline moved closer to published figures and the counter turned positive. A Playwright UI test also caught a bug where text selection cancelled the strokes of the drill input; I fixed it before recording the demo.

Honest limits

  • Simplified rules and a compact approximation of basic strategy, not a full published chart.
  • A positive edge per unit wagered is small, and short sessions are dominated by luck (see the bankroll chart).
  • It does not model casino countermeasures, bet-spread detection, table limits or bankroll risk. Not gambling advice.

How it is built

Plain HTML, CSS and JavaScript, no server or sign-up, runs offline. core.js holds the shoe, Hi-Lo, strategy and Monte Carlo code and is shared by the page and the Node benchmark.

Credits and AI use

Built by one student (electrical engineering undergraduate) with the help of Claude, Anthropic's AI assistant: I directed the work, and Claude wrote most of the code, tests and the demo video. No third-party libraries. MIT license.

What's next (plans, not features)

A full published basic-strategy chart and more rule options, risk-of-ruin estimates, and a multi-card speed-test mode.

Built With

Share this project:

Updates

Submission history