A TypeScript solver for the Countdown numbers game.
In the Countdown numbers game, you are given six integers and a target number. Using basic arithmetic operations (+, -, *, /), combine the six numbers to reach the target. Each number can only be used once, and all intermediate results must be positive integers.
A beautiful web interface is available in the website/ directory, built with TypeScript and Vite.
🌐 Live Demo: The website is automatically deployed to my website.
Features:
- Green-on-black display for the target
- Six blue number cards for input
- Keyboard navigation with Tab and Enter
- Solution display with step-by-step calculations
- Solutions grouped by number of steps (fewest first)
- Intermediate results highlighted with yellow background
- Responsive design for mobile and desktop
- Query parameter support for pre-filling values and auto-solving
- Shareable permalinks to individual solutions
You can pre-fill the target and numbers using URL query parameters:
Comma-separated format:
?target=355&numbers=3,3,5,6,8,100
Individual parameters:
?target=355&n1=3&n2=3&n3=5&n4=6&n5=8&n6=100
When all fields (target and 6 numbers) are provided via query parameters, the solver runs automatically.
Each solution has a "Share" button that makes it easy to share solutions:
- On Apple devices (iOS/macOS), it opens the native share sheet
- On other devices, it copies the permalink to your clipboard
The permalink includes:
- Query parameters with the target and numbers
- An anchor link to the specific solution (e.g.,
#solution-123456)
When someone visits the permalink:
- The form is automatically populated with the numbers
- The solver runs automatically
- The page scrolls to and highlights the specific solution
This makes it easy to share interesting solutions with others!
pnpm run dev # Start development server
pnpm run build # Build for production
pnpm run preview # Preview production buildThis project uses Mise to manage tool versions (Node.js and pnpm).
macOS/Linux:
curl https://mise.run | shHomebrew:
brew install miseOther installation methods: See mise.jdx.dev
After installation, activate Mise in your shell:
# For bash
echo 'eval "$(mise activate bash)"' >> ~/.bashrc
# For zsh
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc
# Then restart your shell or run:
source ~/.bashrc # or ~/.zshrc-
Install tools (Node.js and pnpm):
mise install
-
Install dependencies:
pnpm install
-
Install Playwright browsers (required for OG image generation):
pnpm exec playwright install --with-deps chromium
That's it! Mise will automatically use the correct versions of Node.js (20) and pnpm (10) as specified in .mise.toml.
Note: The Open Graph preview image is generated automatically during the build process by screenshotting the actual website using Playwright.
pnpm test # Run tests once
pnpm run test:watch # Run tests in watch mode
pnpm run test:coverage # Run tests with coverage reportpnpm run type-check # Check TypeScript types
pnpm run lint # Run ESLint
pnpm run format # Format code with Prettier
pnpm run format:check # Check if code is formatted
pnpm run precommit # Run all checks (format, lint, type-check, test)This project uses GitHub Actions for continuous integration and deployment:
-
CI Workflow: Runs on all pushes and pull requests
- Format checking with Prettier
- Linting with ESLint
- Type checking with TypeScript
- Test suite with Vitest
-
Publish Workflow: Deploys to GitHub Pages on main branch
- Runs all precommit checks
- Builds production website
- Automatically deploys to gh-pages
-
Dependabot: Keeps dependencies up to date
- Weekly updates for npm packages and GitHub Actions
- Groups minor and patch updates
- Auto-merges when CI passes
MIT