Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🐞 BugMaster: AI Code Debugging Game

A Streamlit-based game to help developers sharpen their debugging skills on AI-generated buggy Python code — powered by LLaMA3 (via Groq API).


🧠 Overview

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.


💡 Motivation

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.


🛠 Tech Stack

  • Frontend: Streamlit
  • Code Editor: st.text_area (previously streamlit-code-editor)
  • AI Backend: Groq API using LLaMA3
  • Language: Python 3.9+
  • Prompting Engine: Structured prompting to generate original, buggy, and testable code

🚀 How to Run the App

✅ Installation

  1. Clone the repo:

    git clone https://github.com/your-username/bugmaster.git
    cd bugmaster
  2. Create virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # on Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. 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)

▶️ Run the app

streamlit run app.py

🎮 Features

  • 🧩 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

📚 Difficulty Topics

Easy

  • CSV cleaning
  • Basic aggregations
  • Datetime filtering
  • Sorting and ranking
  • Top-N items per group

Medium

  • ETL pipelines
  • Data joins
  • Window functions
  • Data pivoting/unpivoting
  • Time-series anomaly detection

Hard

  • Sessionizing logs
  • Star schema generation
  • Chunk-based large file processing
  • Data audit reports

🤖 Behind the Scenes

  • Prompts are sent in two stages:
    1. Generate clean & tested code with embedded tests
    2. 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.

🧪 Example Flow

  1. User selects "Medium"
  2. AI generates a clean, tested function (e.g., reverse_string)
  3. AI then introduces a bug (e.g., off-by-one error or logic flaw)
  4. User sees only the buggy version and edits it
  5. Upon submit, the backend runs hidden tests to validate the fix

📎 Requirements

  • Python 3.9+
  • Groq API key
  • Internet access (to call LLM)

🤝 Contributing

Pull requests and issues are welcome! Feel free to suggest new features, difficulty levels, or bug templates.


🧠 Future Ideas

  • Leaderboards and timed rounds
  • More languages (JavaScript, Java, etc.)
  • Custom test case input
  • Multiplayer mode (head-to-head debugging)

📜 License

MIT License — feel free to use, fork, and share.


Happy debugging! 🐛🔧

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages