A GeoGuessr-style browser game for code
Project description
CodeGuessr
A GeoGuessr-style browser game for code. Point it at any local repository and try to identify which file a code snippet came from — before all the clues run out.
The UI is styled to look like VS Code.
How it works
Each game consists of several rounds. In every round, a random file from your project is selected and a snippet is shown. The snippet starts almost completely hidden and progressively reveals more code as you make wrong guesses. Click a file in the explorer to guess — the faster you identify it, the more points you earn.
Reveal progression
| Wrong guesses | What you see |
|---|---|
| 0 | Entire file, all characters replaced with █ |
| 1 | 1 line visible (centered on a key line) |
| 2 | 7 lines visible |
| 3 | 17 lines visible |
| 4 | 31 lines visible |
| 5 | Full file, no obscuring |
Scoring
| Guess attempt | Points |
|---|---|
| 1st (no wrong guesses) | 1000 |
| 2nd | 800 |
| 3rd | 600 |
| 4th | 400 |
| 5th | 200 |
| 6th (last chance) | 100 |
Supported languages
TypeScript · JavaScript · Python · Go · Rust · Java · C++ · C · Ruby · Swift · Kotlin · C# · PHP
Installation
Requirements: Python 3.11+, Node.js 18+
# 1. Clone the repo
git clone <repo-url>
cd codeguessr
# 2. Build the frontend and install the package
make install
# or manually:
cd client && npm install && npm run build -- --output-path=../src/codeguessr/static
cd ..
pip install -e .
Usage
# Run against the current directory
codeguessr
# Run against a specific project
codeguessr /path/to/your/project
# Use a different port (default: 4200)
codeguessr --port 8080 /path/to/your/project
The browser opens automatically at http://localhost:4200.
Settings
Before each game, a VS Code-style settings screen lets you configure:
| Setting | Default | Description |
|---|---|---|
| Rounds | 5 | Number of rounds per game (1–20) |
| Guesses per round | 6 | Wrong guesses allowed before the round ends (1–10) |
| Min lines per file | 10 | Files shorter than this are excluded (1–500) |
| Min chars in highlighted line | 1 | Ensures the focal line has meaningful content (0–200) |
| Include pattern | (empty) | Regex — only matching file paths are included |
| Ignore pattern | (empty) | Regex — matching file paths are excluded |
Settings are saved to localStorage and restored on next visit.
The include/ignore patterns are applied to relative file paths (forward-slash separated). The game also respects any .gitignore files found in the scanned directory.
Development
codeguessr/
├── src/codeguessr/
│ ├── game.py # Core logic: file scanning, game state, scoring
│ ├── server.py # FastAPI app — API routes + Angular SPA catch-all
│ ├── cli.py # Click CLI entry point
│ └── static/ # Built Angular output (generated by make build)
├── client/ # Angular 17 standalone app
│ └── src/app/
│ ├── settings/ # Landing/settings screen
│ ├── game/ # Main game screen
│ └── results/ # End-of-game summary
├── tests/
│ ├── test_game.py # Unit tests for game logic
│ └── test_api.py # Integration tests for the FastAPI endpoints
├── Makefile
└── pyproject.toml
Running in development
# Terminal 1 — backend (auto-reload)
CODEGUESSR_DIR=/path/to/project uvicorn codeguessr.server:app --reload
# Terminal 2 — frontend (dev server with proxy)
cd client && npm start
Running tests
pip install -e ".[dev]"
pytest
Rebuilding after frontend changes
make build
How the backend works
scan_directorywalks the project tree, skips pruned directories (node_modules,.git,__pycache__, etc.), respects.gitignorefiles at every directory level usingpathspec, and returns a sorted list of qualifying relative file paths.GameSessionholds the round state for one game. Each round stores a randomly chosen file and a "highlight line" picked from the middle 80% of the file. The session lives in an in-memory dict keyed by a UUID./api/game/newre-scans the directory with the settings from the request body, creates a session, and returns the first round's payload./api/game/{id}/guesschecks the guess, updates the round state, and returns an updated code display with more lines revealed.- The Angular SPA is served via a catch-all route registered after the API routes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codeguessr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: codeguessr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 150.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8be42b5748fbd8b7ae27ef8f28462ef30ed4804b3e2bd0503154c5471ece689c
|
|
| MD5 |
d040f3a5b827d54cfef245c033d0e9c9
|
|
| BLAKE2b-256 |
c7cc9afd5eae177db323e714a77e00b63be630a842e3c20d8f32c7f3ce546e10
|
Provenance
The following attestation bundles were made for codeguessr-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on eroeum/codeguessr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codeguessr-0.1.0-py3-none-any.whl -
Subject digest:
8be42b5748fbd8b7ae27ef8f28462ef30ed4804b3e2bd0503154c5471ece689c - Sigstore transparency entry: 976550581
- Sigstore integration time:
-
Permalink:
eroeum/codeguessr@df737910b4a2d0e3ec2d31dd43c4a304d3865ba8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eroeum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@df737910b4a2d0e3ec2d31dd43c4a304d3865ba8 -
Trigger Event:
workflow_dispatch
-
Statement type: