Skip to main content

AI-powered reverse prompt engineering educational game

Project description

๐ŸŽฏ AI Prompt Engineering Game

PyPI version Python 3.8+ License: MIT

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

  1. See a target image (beautiful sunset, ocean waves, etc.)
  2. Write a prompt describing what you see
  3. AI generates an image based on your prompt
  4. Get scored on how well it matches the target
  5. 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 progress
  • target - Show target image info again
  • help - Show help and tips
  • quit - 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


Made with โค๏ธ for AI education

"Making AI education engaging, measurable, and fun - one prompt at a time!"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_prompt_game-1.0.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_prompt_game-1.0.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

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

Hashes for ai_prompt_game-1.0.0.tar.gz
Algorithm Hash digest
SHA256 940d889a4031efdd58c3f4092ce5639d615026d562bbd24c344312bca1b45619
MD5 e7665528e911e8d2d5c70bb194eecb00
BLAKE2b-256 132eac3a0a4c5348d1e92f5011eeb9df3a79cdfca8160df74c113e8a3e02c3be

See more details on using hashes here.

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

Hashes for ai_prompt_game-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2900d89b293647ff5511940402eb8b2b308e02e94b390934a4dc0b0aa75e3a7
MD5 7085a50b349b6c7ff6ca32a821a8f51b
BLAKE2b-256 7e11750cc439c0057a5c6d7ee693f9976fe2ff0fdf3a3e1d3316f35747cc9898

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page