Inspiration
Classic planarity games ask you to untangle a messy web of edges by dragging vertices around a 2D plane—which works great with a mouse, but quickly gets frustrating inside a compact feed post on mobile. We wanted to strip that feeling down to a tactile, 60-second daily ritual: arrange $N$ pegs around a fixed circle and swap pairs until zero chords cross.
How We Built It
UNTANGLE runs on Devvit Web with a React + SVG frontend, a Hono backend backed by Redis for daily state and streaks, and Devvit Journeys for analytics.
Every daily puzzle is deterministically seeded from its UTC date (FNV-1a + Mulberry32 PRNG) so all players get the exact same board without needing a central puzzle database.
To check whether two chords (a0, a1) and (b0, b1) cross on a circle of N slots, we don't need floating-point geometry—just interval alternation.
Letting l = min(a0, a1) and h = max(a0, a1), the chords cross if and only if one endpoint of b lies strictly inside (l, h) and the other lies outside:
$$\text{cross}(a, b) \iff \bigl(\ell < b_0 < h\bigr) \oplus \bigl(\ell < b_1 < h\bigr)$$
To guarantee a fair, calibrated Par score, the shared engine runs a Breadth-First Search (BFS) over peg permutations to find the minimum number of pairwise swaps required to reach 0 crossings.
Challenges We Faced
- Fitting a responsive SVG loom inside an inline Reddit post: Reddit's inline
tallpost viewport leaves limited vertical space once the HUD and swap bar are rendered. Switching from a modal popup (requestExpandedMode) to aflex: 1; min-height: 0layout allowed the circular loom to scale cleanly without triggering scrollbars. - Tactile input on both desktop and touch: Supporting both drag-and-drop swapping and tap-to-swap with smooth cubic-eased arc interpolation
(
requestAnimationFrame) while preventing page scroll viatouch-action: none. - Server-side verification: Recomputing crossings and validating move sequences on the server so daily streaks and Par wins can't be spoofed.
What We Learned
- Designing for Reddit's inline post constraints forces clarity: every pixel and every instruction has to earn its place.
- Pairing deterministic puzzle generation with a fast exact solver (BFS over swap states) lets you ship endless daily content with mathematically verified Par targets.
Built With
- devvit
- hono
- react