Skip to content
Swappr

Swappr

Show the world how you move it

Created on 24th October 2026

•

Swappr

Swappr

Show the world how you move it

The problem Swappr solves

Here is a detailed, Markdown-formatted response for "The problem it solves" section of your project submission. You can copy and paste this directly into your document.

The Problem
Learning programming logic, algorithmic thinking, and formal mathematical proofs is traditionally a dry, intimidating, and isolating experience. Platforms like LeetCode or textbook theorem-proving lack immediate visual feedback and fail to capture the adrenaline of competitive gaming. Furthermore, professional-grade formal verification tools (like Lean 4) have an incredibly high barrier to entry, keeping these powerful computer science concepts out of reach for beginners.

How Swappr Solves It
Swappr bridges the gap between a fast-paced arcade game and a computer science sandbox. By wrapping strict mathematical proofs in a neon, neo-brutalist aesthetic, it tricks players into writing code and solving complex spatial algorithms just to beat their friends.

Key Use Cases & Benefits:

  • Gamified Algorithmic Thinking: Players learn core programming concepts—sequence, state manipulation, and optimization (solving within a "Max lines" limit)—through intuitive, visual grid commands (swap, rotate, paint).
  • Live Competitive Coding: The real-time Battle mode transforms solitary puzzle-solving into a high-stakes, head-to-head multiplayer esport, forcing players to write efficient logic under pressure.
  • Accessible Formal Verification: Under the hood, every solution is verified by the real Lean 4 mathematical kernel. Swappr safely introduces players to the concepts of formal theorem proving and state validation without requiring them to read a dense computer science manual.
  • Community-Driven Learning: With the Level Builder, educators, developers, and puzzle enthusiasts can generate, share, and challenge others with custom logical scenarios, fostering a community of problem solvers.

By replacing the standard "kids' block game" mechanics with syntax-driven logic, Swappr makes learning to code and structure proofs highly addictive, intensely competitive, and visually rewarding.

Challenges I ran into

Challenges I ran into

  • Making "fewer lines" a fair goal. A shortest-proof score only means something if the optimum is real. I wrote strict helper rules (at most 4 commands, no number literals, no nested helpers) and used a breadth-first search to prove each level's optimal line count. A script re-checks all 67 levels, so the numbers can't drift.
  • Cheating and races on the Daily. Two quick requests could both count as "the one attempt". The completion is now a single database insert keyed on player and day, so the second request is refused. Timers and scores come from the server's clock, never the browser's.
  • Trusting a battle win. A client could just announce "I solved it". The server ignores the claim, re-runs the proof itself, and only a verified solve ends the battle.
  • Smooth animation. Swapped blocks flickered instead of sliding, because the board redrew them. Giving every block a stable ID that follows it through swaps fixed that. A modal also got trapped inside a blurred header, so it now renders in a portal.
  • Messy sound. Fast scrubbing stacked dozens of overlapping tones. I added a voice limit, per-command debouncing and a compressor, so playback stays clean.
  • Random logouts. A backend restart made the login check fail and wiped the saved session. Now only a real "401 Unauthorized" signs you out.
  • Trusting the game rules. To catch rule bugs early, I compared the engine against a second independent model on over 20,000 random proofs, including illegal moves and locked blocks.

Tracks Applied (3)

Open Track - Development

Open Track - Design

Functional Programming Track

Track: FP Launchpad Why Swappr fits this track: Swappr is fundamentally built around functional programming (FP) princi...Read More

FP Launchpad

Discussion

Builders also viewed

See more projects on Devfolio