banner

Inspiration

Word-based puzzles have taken over the internet — and for good reason. They're clever, satisfying, and endlessly shareable. Reddit already has some great ones. But after a while, the formula starts to feel familiar. Another grid, another set of letters, another variation on the same theme.

Sometimes your brain craves something different. Not words — numbers. The kind of quick arithmetic and logic that keeps your mind sharp, especially when you've been doom-scrolling for the last twenty minutes. Mental math is a muscle, and there wasn't really a place on Reddit to exercise it daily.

That's where XO Math Puzzles came from — the idea that our good old math puzzles deserve a home on Reddit too. Not to replace word games, but to sit right alongside them and give people a different kind of daily challenge. Five games, all rooted in arithmetic and logic, designed to make math feel fun again.

What is XO Math Puzzles?

XO Math Puzzles is a math puzzle platform with five original games, each with a distinct mechanic:

  • KenKen — fill a grid so every row and column has unique numbers, respecting cage arithmetic constraints. Notes mode, conflict highlighting, three difficulty levels.
  • Math Maze — trace a path through a number-operator grid from corner to corner, building an expression that hits the target exactly.
  • Cross Math — complete a grid of interlocking equations by placing hidden numbers so every row and column equation resolves correctly.
  • Math Match — a memory card game where pairs are matched by arithmetic relationships (sum, product, or difference equals a target). 3D flip animations, star ratings based on move efficiency.
  • Fence It! — partition a grid into regions where each region's cells sum to a target value. Draw fences by tapping or looping, with color-coded corrals and contiguity validation.

promo_gif

Every game has Easy, Medium, and Hard difficulties. Beyond the games themselves, the platform includes:

  • Daily Puzzles — a new puzzle auto-posts every day at 9 AM UTC with a DAILY PUZZLE flair. First completion earns a bonus.
  • XP Progression — 15 ranks across 5 tiers (Delta → Omega), with XP calculated from a time-based multiplier, performance bonuses, and floor/ceiling guards.
  • Puzzle Sharing — complete a puzzle, share it as a new Reddit post. Other players compete on your puzzle with a mini-leaderboard showing top 3 fastest solvers.
  • Create Mode — step-by-step wizards let players design and publish their own KenKen, Math Maze, and Cross Math puzzles directly to the subreddit.
  • Leaderboards — all-time and weekly, with pagination and personal rank tracking.
  • Player Profiles — tier badges, per-game stats, best times, game history.

How we built it

The app is built on Devvit Web using a three-layer architecture:

Client — React 19 with TypeScript, styled with Tailwind CSS. Each of the five games is its own component with self-contained logic. The UI has three entry points: a splash screen for the feed view (with an animated game card marquee), a shared-puzzle splash (showing the sharer's avatar and puzzle info), and the full-screen game interface.

Server — An Express backend running as serverless Node.js on Devvit's runtime. It handles all API routes — game completion, XP calculation, sharing, leaderboards, daily puzzle scheduling. All data lives in Redis via Devvit's SDK, with atomic operations (hIncrBy, zAdd, zIncrBy) for safe concurrent updates.

Shared — TypeScript types, puzzle generators, XP formulas, and title sanitization logic compiled into both client and server bundles. The puzzle generators are the algorithmic heart of the project — KenKen uses Latin-square generation with backtracking and random cage partitioning, Math Maze uses DFS path generation, Fence It uses region partitioning with target-sum constraints, and so on.

The daily puzzle system uses Devvit's scheduler (cron: 0 9 * * *) and is fully idempotent — duplicate triggers or manual moderator actions won't create duplicate posts. Weekly leaderboards auto-expire via Redis TTL after 14 days. Game history is capped at 50 entries per player to prevent unbounded storage growth.

Everything is built with Vite — the production build outputs static HTML + JS bundles for the three client entry points and a single CommonJS server bundle.

Architecture Diagram

Architecture

Challenges we ran into

Puzzle generation that's always solvable. This was the hardest engineering problem by far. Each game needs a generator that produces a valid, solvable puzzle every single time — across all difficulty levels, with no edge cases that deadlock or produce unsolvable states. KenKen's cage generation with backtracking was particularly tricky; early versions would occasionally produce cages with ambiguous solutions or arithmetic that didn't work with the available operations. Fence It's region partitioning had similar issues — ensuring every cell can be assigned to a region that sums to the target while maintaining contiguity required careful constraint propagation.

XP system balancing. Getting the XP curve to feel rewarding without being exploitable took several iterations. The time multiplier needed to reward fast solvers without punishing people who take their time to think. The floor (40% of base XP) and ceiling (250%) guards were added after testing showed edge cases where extremely fast or slow completions produced weird results. The self-play prevention and first-play-only checks for shared puzzles closed abuse vectors we hadn't initially considered.

Five games in one app — UI/UX coherence. Each game has fundamentally different interaction patterns (tap vs. drag, pick-and-place vs. free input, path drawing vs. region selection), but they all need to feel like they belong to the same product. Keeping the visual language, animations, completion flow, and XP integration consistent across five very different game components was a constant design challenge.

Accomplishments that we're proud of

  • Five fully playable, procedurally generated puzzle games in a single app — not five prototypes, but five games with proper difficulty scaling, validation, tutorials, and polish.
  • The social loop actually works. Sharing a puzzle creates a real Reddit post. Other players compete on it. The mini-leaderboard drives genuine re-engagement. It's not a bolted-on feature — it's core to how the app creates value on Reddit.
  • Create mode. Players aren't just consumers — they can design and publish their own puzzles. This turns the app into a platform, not just a game.
  • Zero external dependencies at runtime. No CDN calls, no analytics, no tracking. The app is self-contained and respects user privacy by design.
  • The XP and tier system feels good. Early ranks come quickly, later ranks require real commitment. The tier names and colors give players identity. It's a small thing, but it makes people want to come back.

What we learned

Procedural generation is an underappreciated skill. Writing a generator that produces a valid KenKen or Fence It puzzle 100% of the time — across difficulty levels, with good variety — is genuinely hard algorithmic work. It gave us a deep respect for the puzzle design behind games like Sudoku apps that make it look effortless.

Constraints breed creativity. Devvit's sandbox limitations initially felt restrictive, but they forced us into a clean three-layer architecture with atomic operations and TTL-based expiry that's actually more robust than what we might have over-engineered with more freedom.

Daily mechanics need to be dead simple to maintain. The idempotent daily puzzle system — where the scheduler, manual triggers, and edge cases all converge to "exactly one puzzle per day, no matter what" — was worth the extra engineering effort. Set-and-forget reliability is everything for a daily game.

Reddit integration is the multiplier. The same five games as a standalone website would be fine. But running natively inside Reddit — where sharing creates real posts, leaderboards drive competition, and the daily puzzle shows up in people's feeds — transforms it from a game into a social experience. The platform is the product.

What's next for XO Math Puzzles

Math + Memory games. We're designing a new category of games that blend arithmetic with cognitive recall. Imagine a grid that flashes a pattern of lit cells for a few seconds — replicate it from memory. Or a sequence of numbers that flashes on screen — add them up in your head and enter the answer before time runs out. These are fast, intense, and perfectly suited for "one more round" daily play. The goal is to exercise a different part of the brain than pure logic puzzles do.

Daily Streaks and Streak Battles. A streak counter for consecutive daily puzzle completions — visible on your profile and leaderboard entry. Miss a day, lose the streak. But here's where it gets interesting: players on long streaks could be matched against each other in weekly spotlight posts — "These 5 players are on 30+ day streaks. Who breaks first?" It gives the community something to follow and root for.

Community Puzzle of the Week. Every week, the most-played user-created puzzle gets featured in a pinned post. This gives creators real visibility and incentive — your puzzle could become the community's challenge for the week. It drives creation, drives play, and drives comments as people discuss strategies and compare times.

Seasonal Events and Themed Weeks. Limited-time puzzle events tied to themes — a "Speed Week" where all daily puzzles are blitz-format with tight time limits, a "Creator Week" where only community-made puzzles are featured, or a "Gauntlet" event where players attempt all five games in sequence with a combined score. Special event badges and XP bonuses make these feel like moments the community shows up for.

More games, always. The architecture is built to support new games cleanly — each one is a self-contained component with its own generator. Number crosswords, arithmetic logic grids, rapid-fire calculation challenges, and more are on the roadmap. The vision is to become the go-to destination for math puzzles on Reddit — a place where there's always something new to solve, share, and talk about.

Built With

Share this project:

Updates