PatternLock
PatternLock is a Reddit-native daily logic game where everyone gets the same lock and the community competes to match the target in the fewest moves.
Inspiration
Daily games are at their best when they create a small shared ritual. PatternLock turns a familiar sliding-tile puzzle into a fair, competitive challenge with a Reddit-native return loop: solve today's lock, compare your result, vote for tomorrow's pattern, and come back to play the pattern the community chose.
What it does
Every UTC day, PatternLock creates one deterministic, solvable puzzle for every player. Players slide numbered tiles into the open space until their board matches the target pattern. Results are ranked first by moves, then by elapsed time, so efficient solutions always win.
After a valid solve, players see their real daily rank, unique solver count, community move average, and server-backed streak. They can open the bounded top-25 leaderboard, copy a spoiler-free result, jump to the Reddit discussion, and vote for one of three deterministic candidates for the next day's target. Each authenticated Reddit user has one effective vote and can safely switch it. The winning candidate becomes tomorrow's shared pattern; ties and zero-vote days resolve deterministically.
How we built it
PatternLock is a Devvit Web application built with React, TypeScript, Vite, Hono, and Redis.
- A shared UTC daily identifier drives puzzle generation, validation, leaderboards, streaks, voting, sharing, and the reset countdown.
- The server reconstructs the canonical starting board and replays a bounded move sequence. Illegal moves, stale dates, malformed proofs, impossible completions, and unreasonable timing are rejected.
- Authenticated Reddit identity comes from trusted Devvit server context; usernames and completion claims are never accepted from the client.
- Versioned Redis keys store one effective best result per user and day, bounded leaderboard data, persistent streaks, aggregate statistics, and atomic vote state.
- Responsive layouts, semantic controls, visible focus, reduced-motion support, accessible tile labels, and touch-sized controls make the game usable across mobile and desktop.
Challenges
The hardest part was making competition data reliable under retries and concurrent requests. A completion may arrive more than once, a player may improve a result, and a vote may switch candidates. PatternLock uses Redis watch/transaction flows and recomputes only the necessary deltas so duplicates do not inflate solver counts, averages, streaks, or votes.
Another challenge was preserving a single fair daily state across time zones. Puzzle generation, result submission, leaderboard keys, streak progression, candidate voting, winner selection, and countdown behavior all use the same server-validated UTC identifier.
What we learned
For a daily game, consistency is the feature. A polished board is not enough: identity, replay validation, idempotent storage, deterministic tie-breaking, and graceful Redis failure behavior are what make the leaderboard feel trustworthy.
We also learned that Reddit creates a natural community loop for daily games. The post is both the game surface and the discussion space, while community voting gives players a meaningful reason to return without adding a separate social system.
What's next
The current release keeps the core loop intentionally focused: solve, compare, vote, return. Future work can improve onboarding and community presentation while preserving deterministic puzzles, server-validated results, bounded data access, and fair fewest-move ranking.
Try it
Play on the verified Reddit test post: https://www.reddit.com/r/pattern_lock_dev/comments/1r2stut/patternlock/
Built With
- css
- devvit
- hono
- html
- javascript
- localstorage
- node.js
- react
- redis
- typescript
- vite