DEV Community

devbox-zero-ops
devbox-zero-ops

Posted on

Building a 365-Day Deterministic Neon Circuit Puzzle in Zero-Dependency JavaScript + Reddit Devvit Redis

Daily bite-sized web puzzles (Wordle-style loops) live or die on two engineering details:

  1. Every UTC calendar date must generate the exact same guaranteed-solvable board for every player worldwide.
  2. Zero-friction onboarding: players should understand the mechanic in 2 seconds without reading a tutorial wall.

While building CircuitPulse Daily for Reddit Interactive Posts (Devvit Web), we wrote a zero-dependency ES module puzzle engine (src/puzzleEngine.mjs) verified across 365 consecutive UTC dates (npm test runs in 97ms).

1. Guaranteed-Solvable Daily Boards via Seeded Prim Spanning Trees

Instead of placing random pipes and hoping they connect, we grow a randomized Prim spanning tree outward from the center SOURCE node (2, 2) using a Mulberry32 PRNG seeded with CircuitPulse:daily:5:YYYY-MM-DD.

Each tile stores a 4-bit connection mask (N=1, E=2, S=4, W=8). Because the underlying graph is a spanning tree:

  • Every single tile is guaranteed reachable from the center power core.
  • Scrambling ~78% of rotatable tiles yields an exact mathematical Par (minimum clockwise taps to solve).
  • Live BFS power propagation (computePowered) lights up connected neon paths on every tap.

2. Native Reddit Community Loop (Redis Streaks + Spoiler-Free Emoji Sharing)

Using Devvit Web Redis sorted sets (zAdd / zRange), daily completions rank by moves * 10000 + elapsedSec (fewest moves first, then fastest time), while tracking consecutive UTC day streaks and generating a 1-click spoiler-free emoji grid (🟦 / 🟩 / 🟨) for Reddit comments.

Play Live & Inspect the Code


Running self-hosted Python/Node services on a VPS? Check out our free $0+ VPS Ops Check CLI or grab the 3-in-1 Self-Hosted Python Ops Bundle ($5.99).

Top comments (0)