Inspiration
Chess puzzles are a great daily ritual, but every chess player already knows every pattern. We wanted a puzzle where your instincts are wrong in an interesting way, so we changed one rule:
When a piece captures, it becomes the type of piece it captured. A Soldier that takes a Tower becomes a Tower. A Tower that takes a Soldier becomes a Soldier. The Crown never transforms.
Every capture is now a trade-off. Grabbing material can downgrade your attacker, and a sacrifice can turn the enemy's best defender into a harmless Soldier.
What it does
Crownshift Daily. Every day at 00:05 UTC the subreddit gets a new post: a forced checkmate in 4.
- The defender always plays its toughest reply.
- Every puzzle has exactly one winning first move, usually a quiet move (no check, no capture) and often a sacrifice. Every solution needs at least one transformation.
- A wrong move resets only the current step and counts as a try. A hint unlocks after 2 misses.
The Reddit loop
- Inline feed preview: the board, the side to move, and how many redditors played and solved today.
- 🔥 Streaks: best streak and total solves are tracked.
- Two leaderboards: ⏱ Fastest (lowest time wins, ties go to fewer tries) and 🎯 Fewest tries. A live timer runs while you solve; it is anchored to the server, so refreshing doesn't reset it.
- Share to comments: one tap posts a spoiler-free result such as
🟥🟥🟩 · 🔥 4-day streakas your comment, so the thread becomes the day's scoreboard. - Opt-in streak flair:
🔥 7 · 23 solved. - Archive: older daily posts stay playable, with their leaderboards.
Live PvP. Choose "Challenge the subreddit" to create a match post. The first redditor to tap Take Blue plays you. The server validates every move against its own game state, and both boards update in real time.
Pass & Play and Learn in 60 seconds. A full local game with undo, board flip and resign. Five interactive lessons teach the whole rule set using the real engine, and first-time visitors see them automatically.
How we built it
- Devvit Web: a React 19 + Tailwind 4 client with a lightweight splash view for the feed and an expanded game view.
- Hono server on Devvit: Redis holds stats, streaks and sorted-set leaderboards. Matches use WATCH/MULTI/EXEC optimistic concurrency and broadcast over Devvit realtime. A scheduler cron posts the daily puzzle, plus there's an install trigger and mod menu actions.
- Rules engine: one framework-free, immutable TypeScript engine runs on both client and server. It covers transformation-then-promotion, Crown safety evaluated after transformation, checkmate, stalemate, threefold repetition, the 100-half-move rule and bare-Crowns draws.
- Puzzle generation: we wrote an offline solver on a mutable
Int8Arrayboard, with make/unmake, a transposition table and move ordering. It averages about 12 ms per mate-in-4 search. Differential tests on 2,500 positions show it matches the reference engine move for move.- 12 parallel workers produced 2,607 valid mate-in-4 positions.
- Filters: exact mate distance, a unique key move, at most 2 alternatives at later steps, a transformation in the solution, and a key move that isn't the greedy choice.
- The top 120 were kept: 112 have quiet key moves and 114 involve a sacrifice.
- Each puzzle ships with a precomputed solution tree: every winning move at each step, plus the best defence. Judging is therefore instant and exact, and the server re-verifies every claimed solve.
- Tests: 206 Vitest tests cover rule scenarios, edge cases (pins, checks created by a transformation), random-playout invariants, full re-verification of every puzzle tree against both engines, and the server and leaderboard logic. Playwright browser tests run the tutorial and a full 4-move solve.
Challenges we ran into
- Mate-in-2 puzzles turned out to be too easy in playtesting. A naive mate-in-4 search was far too slow, so we built the fast solver. Before trusting it, we proved it agrees with the reference engine.
- Puzzles with several winning lines must never mark a correct alternative as wrong. The solution trees store all winning moves at every step.
- The rule interactions are subtle, for example a Soldier that captures a Tower on the last rank becomes a Tower and doesn't promote. The engine evaluates check only on the board after transformation.
Accomplishments we're proud of
- An original chess variant with its own pieces, SVG art and rules.
- Puzzles that are genuinely hard and machine-verified.
- A daily loop built around Reddit: comments, flair, feed previews and subreddit-wide PvP.
What's next
- Rule-balance tuning from self-play data (documented in BALANCE.md).
- Weekly themed puzzle sets and community-submitted puzzles that the solver verifies.
How to test
Open the demo post in r/crownshift_dev and tap the board. The tutorial runs on first visit. To try PvP, open the subreddit menu, choose Crownshift: start a PvP match, then take Blue from a second account.
Built With
- devvit
- hono
- playwright
- react
- redis
- tailwindcss
- typescript
- vite
- vitest