Published on

BanglaABC123: a number matching game I built for my kids

BanglaABC123: a number matching game I built for my kids
Authors
On this page

My kids had exams coming up. They needed to know the numbers 1 to 100 in both English and Bengali, and they were far more excited about games than flashcards.

So I turned the flashcards into a game.

BanglaABC123 is a matching game. Half the cards show an English number, half show the same number in Bengali digits, and you match 7 with ৭. Tap a card and native browser speech synthesis reads it out loud in the right language, in under 50ms.

The data is one list of 100 pairs

Everything starts from src/data/numbers.ts, a list of 100 entries. Bengali digits are plain Unicode strings, so there are no font tricks:

{
  english: "100",
  bengali: "১০০",
  pronunciation: "æksho",
  englishPronunciation: "one hundred",
}

The pronunciation fields are what the speech engine reads. æksho is a rough phonetic spelling of the Bengali word for one hundred.

One pair becomes two cards

Each pair turns into two cards that share a value. The English card and the Bengali card both carry value: pair.english, so a match is just a string comparison:

return filteredNumberPairs.flatMap((pair, index) => [
  generateGameItems(pair, index, 'english', numberOfCards),
  generateGameItems(pair, index, 'bengali', numberOfCards),
])

The deck gets a Fisher-Yates shuffle. Two flipped cards match when firstCard.value === secondCard.value. A second later the selection resets and the next turn starts.

How a round works: pick a range of 10 numbers, take the first N pairs, make an English and a Bengali card for each, shuffle, then match cards with the same value

Here's a detail I only noticed while writing this. The shuffle randomizes where the cards sit, but the numbers in play are always the first N of the range. With 3 cards in the 1-10 range, you always get 1, 2 and 3.

That turned out to be what I wanted for small kids. The numbers grow in order as they level up.

Hearing the number

Speech took five lines, because the browser already has text to speech:

const utterance = new SpeechSynthesisUtterance(pronunciation)
utterance.lang = type === 'bengali' ? 'bn-BD' : 'en-US'
speechSynthesis.speak(utterance)
A smiling speech bubble pops out of a tablet with sound waves while a small hand taps animal picture cards.

How the Bengali voice sounds depends on which voices the device has installed for bn-BD. Either way, a child hears the number every time they tap it, in the script they're looking at.

Levels and settings

When a round is done, a Next button adds one card pair. Past 10 pairs, it drops back to 3 and moves to the next block of 10 numbers, so 1-10 becomes 11-20.

The settings screen has a card count slider, a range picker (1-10 up to 91-100), and two on/off switches: animal icons on the cards and colored cards.

State lives in a small Zustand store, and each setter writes its value to localStorage. So the settings survive a reload, but the score and the current round don't. For short practice rounds, that was fine.

What I'd fix

Most of the code came out of two evenings in December 2024. Reading it again, I can see the rough edges and a few real flaws:

  • No tests. The CI step that runs them ends in || true, so it can never fail.
  • The reset timer is never cleared. If the board unmounts during that one second, the callback still runs.
  • No guard around localStorage. A corrupted value would make JSON.parse throw on load.
  • The last range has nowhere to go. After 91-100 the next start is 101, and there are no pairs past 100, so the deck would come out empty. I haven't tested that path.

None of these break a normal round, which is why they're still there.

The stack

React 18, TypeScript, Vite, Tailwind CSS, Zustand, and lucide-react for the animal icons. It's a static site on Vercel with no backend, no accounts and no ads. A self-hosted Plausible script counts page views, without cookies. The repo has 44 commits between December 2024 and June 2026.

If you have kids learning Bengali numbers, it's free to use. And here's my one lesson if you build something similar: start with the browser's speech API. It was the cheapest feature in the whole game.


Resources