Inspiration

The best daily games—like Wordle, Connections, and Mini Crosswords—share three traits: zero-friction onboarding, deterministic fairness (everyone on Earth solves the exact same puzzle each day), and expressive community rituals after the solve.

We wanted to bring tactile spatial physics to Reddit's feed without requiring language fluency or trivia memorization. PrismGrid turns additive optics (Red + Blue = Purple) into a crisp 60-second daily ritual built natively on Devvit Web.

What it does

Every day at 00:00 UTC, PrismGrid generates a deterministic 6×6 optical lattice (A1–F6) with a mathematically verified minimum mirror count (Par):

  • Additive Laser Color Mixing: Route Crimson Red (R) and Electric Blue (B) emitters using rotatable / and \ mirrors and fixed 50/50 Beam Splitters (💠) so every crystal target receives its exact required wavelength—including Purple (P = R + B) crystals where Red and Blue beams must intersect or merge.
  • Unobstructed Live Feed Preview (splash.html): Before even tapping Enter PrismGrid, Redditors see today's real 6×6 optical grid rendered live in the feed alongside solver counts, the #1 fastest optician, personal daily streak, and UTC countdown.
  • State-Aware 3-Stage Smart Hint Coach: Instead of static coordinate spoilers, our optical diagnostic coach ray-traces the player's actual live board—adapting to alternative valid Par routes, flagging blocking mirrors (✕) or misoriented / vs \ angles (↻), and offering three progressive stages (Stage 1: causal illuminated cell nudge → Stage 2: golden dashed angle preview on Canvas → Stage 3: single-step apply).
  • Deep Reddit Community Loop:
    • Anti-Cheat Server Ray-Tracing & Snoovatar Leaderboard: POST /api/solve re-simulates mirror placements on the server before recording verified ranks (mirrorsUsed, then elapsedMs) with Reddit Snoovatar avatars.
    • Automatic Subreddit User Flairs: Solvers automatically earn dynamic flairs (🌟 Under Par • 🔥 Streak, ⚡ Par Optician, 🔮 Prism Solver).
    • 1-Click Spoiler-Free Comment Share Cards: Posts a 6×6 emoji beam-trace card directly to the Reddit post's comment thread—showing glowing laser paths while masking player mirror positions with ⬜ so nothing is spoiled.
    • Play-to-Verify Community Workshop: Players design custom 6×6 optical puzzles, check ≤ 5-mirror solvability in one click, prove solvability by beating their own level (Par auto-calibrated on the server), and publish it immediately as a brand-new playable Reddit post.

How we built it

  • Frontend (src/client/): Built with React 19, Tailwind CSS, and a custom high-DPI HTML5 Canvas 2D optical renderer (OpticalBoard.tsx) featuring flowing photon pulses, partial-charge half-arc crystal indicators, celebratory spark bursts, prefers-reduced-motion controls, single-tab-stop WAI-ARIA toolbar navigation, roving-tabindex keyboard grid play (A1–F6), and procedural Web Audio API harmonic chimes (audio.ts).
  • Shared Deterministic Physics & Solver Engine (src/shared/puzzle.ts): Cycle-safe split-beam ray tracer (traceOpticalGrid with state hashing (cell, incomingDirection)), seeded Mulberry32 daily generator, minimum-mirror BFS Par verifier (findMinimumMirrors), redundant-mirror pruner (pruneRedundantMirrors), and causal bounce-order analyzer (orderSolutionCausally + analyzeBoardForHint).
  • Backend (src/server/): Powered by @devvit/web + Hono + Devvit Redis (zAdd sorted sets for composite mirrorsUsed * 10^8 + elapsedMs ranking, hSet per-user solve records & streak tracking, daily UTC cron scheduler 0 0 * * *, and reddit.submitCustomPost / reddit.submitComment / reddit.setUserFlair).

Challenges we ran into

  1. Guaranteeing True Par Fairness Across Every UTC Day: Randomly placed emitters and crystals can create trivial 1-mirror solves or impossible boards. We built an exact combinatorial BFS solver (findMinimumMirrors) that prunes redundant mirrors and verifies every generated daily board has a clean, non-trivial Par solution, verified across 90 consecutive daily seeds in automated unit tests.
  2. Making Hints Feel Like an Optical Coach, Not a Spoiler: Early static coordinate hints broke whenever a player discovered an alternate route, placed / instead of \, or added an extra blocking mirror upstream. Refactoring hints into analyzeBoardForHint + orderSolutionCausally ensured every hint targets an actively illuminated cell in physical bounce order and stays locked on a cell until its angle is aligned.
  3. Infinite Optical Loops with Beam Splitters: Fixed 50/50 splitters can create closed rectangular feedback loops with player mirrors. Tracking visited (cellIndex, incomingDirection) states made ray-tracing O(36 × 4) worst-case and rock-solid on both client Canvas and server verification.

Accomplishments that we're proud of

  • Zero-spoiler Emoji Beam Share Cards that turn every Reddit comment section into a colorful mosaic of optical paths without giving away mirror placements.
  • Play-to-Verify Workshop where every community-published Reddit post is mathematically guaranteed solvable with an exact server-calibrated Par.
  • Full keyboard, screen-reader, and pause-aware timer ergonomics inside a crisp neon aesthetic that feels right at home in Reddit Dark Mode.

What we learned

Building on Devvit Web showed how tightly a game loop can weave into Reddit's native primitives: custom inline splash previews eliminate cold-start friction, Redis sorted sets make global daily leaderboards effortless, and submitCustomPost lets players become level designers for their entire subreddit.

What's next for PrismGrid

  • Chromatic Filters & Wavelength Absorbers (cyan/yellow/magenta subtractive filters for weekend "Master Spectrum" challenges).
  • Weekly Subreddit vs. Subreddit Optics Tournaments aggregating community Par efficiency across participating communities.

Built With

Share this project:

Updates

Submission history