Inspiration

We wanted to get better at competitive programming, but got bored of leetcode and codeforces. So we took love for video games and implemented a ranked 1v1 system into coding.

What it does

You make an account to sign in and you can compete 1 on 1 with players on leetcode-style problems. The goal is to reach (or understand) the "core" of the problem before your opponent with rewards along the way.

How we built it

code2core is built as a Next.js app on Supabase, which handles sign-in, the Postgres database, and Realtime for live opponent progress, spectating and dig updates.

  • Judging: To grade a player's answer we have multiple tests that go to a judge inside the app (Next.js API routes). This judge works by checking the player's session, loading the hidden tests, and runing the code on a self-hosted Azure VM.
  • Deployment: Deployed on Vercel at code2core.vercel.app. The built-in judge runs as Vercel serverless functions that call Judge0 on our Azure VM, so anyone can play from a link with no setup.
  • Game rules: The game rules are in Postgres. This allows us to track which player reached a gem and when, separte players' clock.
  • Winners: Passing every test wins. If both players pass, an AI review (DeepSeek, through OpenCode) compares time and space complexity. If the solutions are still equal, the deeper and faster dig wins.
  • Ratings: Ratings use Glicko, so that we can track skill like a chess rating.

Challenges we ran into

  • We first tried self-hosting Judge0 (the sandboxed code runner) on the Arduino UNO Q. The board has an ARM chip while Judge0 needed an x64 server. We first tried to use an unofficial community image, but it was untested, and UW's campus Wi-Fi blocked the 3 GB download behind a browser sign-in the headless board couldn't complete. We then moved Judge0 to an Azure VM, where the official image ran sandboxed smoothly.
  • Our original tests were too small: a brute-force Two Sum passed all of them at the same speed as the fast solution. We had to generate inputs sized to force the slow solution to run far slower (4.7 s vs 0.28 s).
  • Issues when clicking submit when when time ends. We needed to figure out how to we autosave code drafts and have the server judge everyone's latest code before deciding.

Accomplishments that we're proud of

  • A competitive coding duel where results can't be faked since every score comes from a server-side sandbox, and rules enforced by the database.
  • Dig Deep: We wanted it to be a core part of our ranked system. It literally means passing harder tests so that programmers can improve their skills in layers.
  • Chess-site polish: matchmaking by rating, time controls, Glicko ratings, spectating, replays and rematches.

What we learned

  • How to wire Supabase (auth, Postgres, Realtime) to a self-hosted Judge0 on an Azure VM.
  • FastAPI: we built our first judge server in FastAPI, then moved it into the Next.js app.
  • Anything decided in the browser can be faked, so the server and database need to contain the results, timing and rewards.
  • How much coordination parallel work on a shared database needs: migration order, overlapping functions, and agreeing on rules before building.

What's next for code2core

  • Excavation report: after each game, a timeline of both players' digs and a more comprehensive AI analysis.
  • Depth on profiles and the leaderboard: Bedrock rate, fastest time to Bedrock, and a "deepest diggers" ranking.
  • More problems, each authored as a dig site from the start, with per-language time limits so C++ and Python are judged fairly.
  • Production hardening: HTTPS between the app and Judge0, closing Judge0 to the internet, and a scheduled job that settles games when both players leave.
  • Block code support, avatar customization, and saving friends.
  • Being able to play as a guest

Built With

Share this project:

Updates

Submission history