Back to Projects
🟒 LIVE

Mental Math Trainer

A mental arithmetic trainer for quant/trading-interview drills β€” configurable operations, number types, and question formats, with realistic quant-assessment number distributions, optional Google sign-in, and a database-backed performance history.

Open Live App View on GitHub

TECH STACK

Next.jsTypeScriptZustandAlgorithm DesignVitestTailwind CSS

Deep Dive

A quant/trading-interview-style mental arithmetic trainer built around a from-scratch question engine rather than uniform random generation. Addition and subtraction follow weighted digit-count tiers (2-digit through 7-digit operands), multiplication mixes "easy" tiers against "hard" near-square products (43Γ—47, 84Γ—86), and division always constructs the divisor and quotient first so the result is exact by construction β€” no rejection sampling. Decimal arithmetic runs on scaled integers to avoid floating-point drift, and a Fraction class is always reduced to an improper fraction by construction, with answer-checking that strictly rejects mixed numbers and unreduced forms.

Sessions are fully configurable: independent toggles for each operation and number type (integers, decimals, fractions, percentages), a duration slider (1-10 minutes), a question-count slider (20-120 or unlimited), and Open or Multiple Choice answer formats β€” a session ends at whichever limit is hit first. Typing the exact correct answer submits instantly with no Enter key needed, and Multiple Choice supports 1-5 keyboard shortcuts.

Progress tracking (an activity grid, lifetime stats, last-session results, and a recent score trend chart) runs on a repository-interface seam that keeps every consuming component agnostic to where data lives. Guest mode persists to localStorage with no account required; signing in with Google swaps the same interface to a Postgres-backed implementation (Auth.js + Prisma on Supabase) with zero UI changes required β€” same dashboard, same components, just backed by a database instead of the browser.