You asked an AI to build a simple "Number Guessing Game" using Streamlit. It wrote the code, ran away, and now the game is unplayable.
- You can't win.
- The hints lie to you.
- The secret number seems to have commitment issues.
- Install dependencies:
pip install -r requirements.txt - Run the broken app:
python -m streamlit run app.py
- Play the game. Open the "Developer Debug Info" tab in the app to see the secret number. Try to win.
- Find the State Bug. Why does the secret number change every time you click "Submit"? Ask ChatGPT: "How do I keep a variable from resetting in Streamlit when I click a button?"
- Fix the Logic. The hints ("Higher/Lower") are wrong. Fix them.
- Refactor & Test. - Move the logic into
logic_utils.py.- Run
pytestin your terminal. - Keep fixing until all tests pass!
- Run
- Describe the game's purpose.
- Detail which bugs you found.
- Explain what fixes you applied.
Describe your fixed game in numbered steps so a reader can follow along without watching a video:
Screenshot (optional):
# Paste your pytest output here, e.g.:
# pytest tests/
# ========================= X passed in 0.XXs =========================
- [If you choose to complete Challenge 4, describe the Enhanced UI changes here — a screenshot is optional]