AI-powered reverse prompt engineering educational game
Project description
๐ฏ AI Prompt Engineering Game
Learn AI prompt engineering through reverse engineering! ๐ฎ
An educational CLI game where students see a target image and must craft prompts to recreate it using AI image generation. Perfect for learning prompt engineering, visual analysis, and AI communication skills.
๐ Quick Start
Install
pip install ai-prompt-game
Play
ai-prompt-game
That's it! The game will guide you through setup and start your first challenge.
๐ฎ How It Works
- See a target image (beautiful sunset, ocean waves, etc.)
- Write a prompt describing what you see
- AI generates an image based on your prompt
- Get scored on how well it matches the target
- Improve and try again until you master it!
Example Game Flow
๐ฏ Target: Mountain Sunset
[Shows beautiful sunset image]
[Attempt #1] Your prompt: landscape
๐ Score: 23.4% - "Too generic! Describe the colors and lighting."
[Attempt #2] Your prompt: sunset over mountains
๐ Score: 67.8% - "Better! Add more details about the dramatic sky."
[Attempt #3] Your prompt: golden sunset over mountain peaks with dramatic clouds
๐ Score: 89.1% - "Excellent! Almost perfect!"
๐ You're learning prompt engineering!
โจ Features
- ๐ฏ Multiple Challenges: Mountain sunsets, ocean waves, forests, beaches, aurora
- ๐ค Real AI Generation: Uses Pollinations.ai (free) or your own models
- ๐ Smart Scoring: 4-metric similarity analysis (structure, colors, edges, composition)
- ๐ Educational Feedback: Learn what makes prompts effective
- ๐ Progress Tracking: See your improvement over time
- ๐ Works Offline: After setup, only AI generation needs internet
๐ ๏ธ Installation Options
Option 1: Simple Install (Recommended)
pip install ai-prompt-game
ai-prompt-game --setup # Download challenge images
ai-prompt-game # Start playing!
Option 2: Development Install
git clone https://github.com/yourusername/ai-prompt-game.git
cd ai-prompt-game
pip install -e .
ai-prompt-game --setup
Option 3: With Advanced AI Models
# For local Hugging Face models
pip install ai-prompt-game[huggingface]
# For Replicate API
pip install ai-prompt-game[replicate]
๐ฏ Game Commands
ai-prompt-game # Start interactive game
ai-prompt-game --setup # Setup game files and targets
ai-prompt-game --list-targets # Show available challenges
ai-prompt-game --target sunset # Play specific challenge
ai-prompt-game --quick # Quick 5-minute game
ai-prompt-game --stats # Show your progress
In-Game Commands
progress- Show current game progresstarget- Show target image info againhelp- Show help and tipsquit- Exit game
๐ Educational Value
Perfect for learning:
- Prompt Engineering: How to communicate effectively with AI
- Visual Analysis: Breaking down images into describable components
- Iterative Improvement: Learning from feedback and refining
- AI Understanding: How image generation actually works
For Educators
- Measurable Learning: Quantified skill improvement
- Engaging Format: Students love the game approach
- Scalable: Works for 1 or 1000 students
- Progress Tracking: Built-in analytics and statistics
๐ค AI Models Supported
| Model | Cost | Quality | Setup |
|---|---|---|---|
| Pollinations.ai | Free | High | None (default) |
| Hugging Face | Free | Very High | Local GPU recommended |
| Replicate | Pay-per-use | Highest | API key required |
Using Different Models
# Use Pollinations.ai (default, free)
ai-prompt-game --model pollinations
# Use local Hugging Face model
ai-prompt-game --model huggingface
# Use Replicate API
ai-prompt-game --model replicate
๐ Scoring System
The game uses a sophisticated 4-metric scoring system:
- Structure (30%): Layout and composition matching
- Colors (25%): Color distribution and palette
- Edges (25%): Shape and boundary detection
- Dominant Colors (20%): Key color matching
Combined Score: Weighted average of all metrics (0-100%)
๐ฏ Challenge Targets
- ๐ Mountain Sunset (Medium) - Golden hour over peaks
- ๐ Ocean Waves (Hard) - Powerful waves on rocky shore
- ๐ฒ Misty Forest (Medium) - Peaceful forest path with mist
- ๐๏ธ Tropical Beach (Easy) - Crystal clear water and white sand
- ๐ Northern Lights (Hard) - Aurora borealis over snow
๐ Example Learning Progression
Session 1: "landscape" โ 15.6% โ "Be more specific!"
Session 2: "sunset mountains" โ 42.3% โ "Add color details!"
Session 3: "golden sunset over mountain peaks" โ 68.7% โ "Great progress!"
Session 4: "golden sunset over mountain peaks with dramatic clouds" โ 89.1% โ "Almost perfect!"
Session 5: "golden sunset over mountain peaks with dramatic orange clouds and lake reflection" โ 96.7% โ "MASTERY!"
๐ Result: Student learned effective prompt engineering!
๐ง Advanced Usage
Custom Targets
from ai_prompt_game import PromptGame
game = PromptGame()
game.add_custom_target("my_image.jpg", "My Custom Challenge")
API Integration
from ai_prompt_game import ImageGenerator, ImageComparison
generator = ImageGenerator("pollinations")
comparator = ImageComparison()
# Generate image
image = generator.generate("sunset over mountains")
# Compare with target
scores = comparator.compare(image, target_image)
print(f"Similarity: {scores['combined']:.3f}")
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Development Setup
git clone https://github.com/yourusername/ai-prompt-game.git
cd ai-prompt-game
pip install -e .[dev]
pytest # Run tests
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- Pollinations.ai for free, high-quality image generation
- Unsplash for beautiful target images
- OpenCV for image processing capabilities
- Education community for inspiration and feedback
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: your.email@example.com
Made with โค๏ธ for AI education
"Making AI education engaging, measurable, and fun - one prompt at a time!"
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 Distribution
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 ai_prompt_game-1.0.0.tar.gz.
File metadata
- Download URL: ai_prompt_game-1.0.0.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
940d889a4031efdd58c3f4092ce5639d615026d562bbd24c344312bca1b45619
|
|
| MD5 |
e7665528e911e8d2d5c70bb194eecb00
|
|
| BLAKE2b-256 |
132eac3a0a4c5348d1e92f5011eeb9df3a79cdfca8160df74c113e8a3e02c3be
|
File details
Details for the file ai_prompt_game-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_prompt_game-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2900d89b293647ff5511940402eb8b2b308e02e94b390934a4dc0b0aa75e3a7
|
|
| MD5 |
7085a50b349b6c7ff6ca32a821a8f51b
|
|
| BLAKE2b-256 |
7e11750cc439c0057a5c6d7ee693f9976fe2ff0fdf3a3e1d3316f35747cc9898
|