A Streamlit-based game to help developers sharpen their debugging skills on AI-generated buggy Python code — powered by LLaMA3 (via Groq API).
BugMaster is a game where developers debug broken Python code generated by a large language model (LLM). Each round presents you with AI-generated code that almost works — your job is to fix it until it passes all hidden test cases.
Modern developers increasingly rely on AI to write code — but AI isn't always right. In fact, AI can generate convincing but subtly broken logic. This game helps developers build the essential skill of debugging AI-generated code, making them faster, smarter, and more resilient coders.
⚠️ Vibe coders must learn how to debug AI code — it’s a critical 2020s skill.
- Frontend: Streamlit
- Code Editor:
st.text_area(previouslystreamlit-code-editor) - AI Backend: Groq API using LLaMA3
- Language: Python 3.9+
- Prompting Engine: Structured prompting to generate original, buggy, and testable code
-
Clone the repo:
git clone https://github.com/your-username/bugmaster.git cd bugmaster -
Create virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # on Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set your Groq API key:
- Option 1: Set it in your environment
export GROQ_API_KEY=your_api_key_here - Option 2: Hardcode it directly inside the app (not recommended for production)
- Option 1: Set it in your environment
streamlit run app.py- 🧩 AI-Generated Buggy Code: Based on real-world problems and LLM-crafted challenges
- 🧠 Three Difficulty Levels: Easy, Medium, and Hard — each increasing in code complexity and logic depth
- ⌨️ Editable Code Editor: Edit and fix the broken code directly in the app
- 🧪 Hidden Test Cases: Executed silently to verify your fix — you don’t get to see them
- ⏱️ Time-Based Performance: Solve faster and celebrate with confetti
- ✅ Instant Feedback: Know immediately whether your fix passed or failed
- CSV cleaning
- Basic aggregations
- Datetime filtering
- Sorting and ranking
- Top-N items per group
- ETL pipelines
- Data joins
- Window functions
- Data pivoting/unpivoting
- Time-series anomaly detection
- Sessionizing logs
- Star schema generation
- Chunk-based large file processing
- Data audit reports
- Prompts are sent in two stages:
- Generate clean & tested code with embedded tests
- Introduce subtle bugs (syntax or logic) into the clean code
- Only the buggy portion is shown to the user; hidden tests are stored and evaluated behind the scenes.
- User selects "Medium"
- AI generates a clean, tested function (e.g.,
reverse_string) - AI then introduces a bug (e.g., off-by-one error or logic flaw)
- User sees only the buggy version and edits it
- Upon submit, the backend runs hidden tests to validate the fix
- Python 3.9+
- Groq API key
- Internet access (to call LLM)
Pull requests and issues are welcome! Feel free to suggest new features, difficulty levels, or bug templates.
- Leaderboards and timed rounds
- More languages (JavaScript, Java, etc.)
- Custom test case input
- Multiplayer mode (head-to-head debugging)
MIT License — feel free to use, fork, and share.
Happy debugging! 🐛🔧