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 fixed50/50Beam 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 real6×6optical grid rendered live in the feed alongside solver counts, the#1fastest 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
Parroutes, 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/solvere-simulates mirror placements on the server before recording verified ranks (mirrorsUsed, thenelapsedMs) 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×6emoji 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×6optical puzzles, check≤ 5-mirror solvability in one click, prove solvability by beating their own level (Parauto-calibrated on the server), and publish it immediately as a brand-new playable Reddit post.
- Anti-Cheat Server Ray-Tracing & Snoovatar Leaderboard:
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-motioncontrols, single-tab-stop WAI-ARIAtoolbarnavigation, 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 (traceOpticalGridwith state hashing(cell, incomingDirection)), seeded Mulberry32 daily generator, minimum-mirror BFSParverifier (findMinimumMirrors), redundant-mirror pruner (pruneRedundantMirrors), and causal bounce-order analyzer (orderSolutionCausally+analyzeBoardForHint). - Backend (
src/server/): Powered by@devvit/web+ Hono + Devvit Redis (zAddsorted sets for compositemirrorsUsed * 10^8 + elapsedMsranking,hSetper-user solve records & streak tracking, daily UTC cron scheduler0 0 * * *, andreddit.submitCustomPost/reddit.submitComment/reddit.setUserFlair).
Challenges we ran into
- Guaranteeing True
ParFairness 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-trivialParsolution, verified across 90 consecutive daily seeds in automated unit tests. - 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 intoanalyzeBoardForHint+orderSolutionCausallyensured every hint targets an actively illuminated cell in physical bounce order and stays locked on a cell until its angle is aligned. - Infinite Optical Loops with Beam Splitters: Fixed
50/50splitters can create closed rectangular feedback loops with player mirrors. Tracking visited(cellIndex, incomingDirection)states made ray-tracingO(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
Parefficiency across participating communities.
Built With
- devvit
- html5
- react
- typescript