Overview
This prompt aims to guide developers in creating an AI agent for a PC game, enhancing their programming and machine learning skills. Game developers and AI enthusiasts will benefit by learning how to implement reinforcement learning in a practical scenario.
Prompt Overview
Purpose: The AI agent aims to master the “Red Light Green Light” game by learning optimal movement strategies.
Audience: This project is intended for game developers and AI enthusiasts interested in reinforcement learning applications.
Distinctive Feature: The AI employs adaptive learning techniques to improve its gameplay based on real-time feedback from the environment.
Outcome: The final product will be a well-documented AI capable of efficiently navigating the game while avoiding penalties.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: AI Agents & Automation, Machine Learning & Data Science
- Techniques: Decomposition, Plan-Then-Solve, Self-Critique / Reflection
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Develop an AI agent for a PC game that learns to play “Red Light Green Light.”
The AI should understand and follow the game’s core mechanics:
– Move forward only during the “green light” phases.
– Stop immediately during “red light” phases to avoid being caught.
Implement learning strategies such as reinforcement learning or other suitable machine learning techniques to enable the AI to improve its performance over time through practice and interaction.
**Requirements:**
– Simulate the “Red Light Green Light” environment with clearly defined light phases.
– The AI perceives the current light state and decides when to move or stop.
– Incorporate learning mechanisms so the AI’s gameplay improves progressively.
– Include logic for the AI to identify penalty conditions (e.g., moving during red light) and adjust its behavior accordingly.
– The AI should aim to reach the finish line as quickly and safely as possible.
**# Steps**
1. Define and simulate the game environment, including timing and switching of green and red lights.
2. Design the AI’s input perception system (e.g., detecting light state).
3. Choose and implement a learning algorithm (e.g., reinforcement learning).
4. Train the AI through multiple gameplay sessions.
5. Evaluate AI performance and refine the model.
**# Output Format**
Provide the complete and well-documented source code for the AI player and game simulation.
Additionally, include:
– A detailed explanation of the learning approach used.
– Instructions on how to run and test the AI in the “Red Light Green Light” environment.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste the prompt into your coding environment.
- Follow the outlined steps to develop the AI agent.
- Implement the game simulation as described.
- Test the AI’s performance and refine as needed.
- Document your code and learning approach thoroughly.
Tips for Best Results
- Define Game Environment: Create a simulation that alternates between red and green light phases with precise timing.
- Input Perception System: Implement a mechanism for the AI to accurately detect the current light state to decide when to move or stop.
- Learning Algorithm: Utilize reinforcement learning techniques to enable the AI to learn from its actions and improve over time.
- Performance Evaluation: Regularly assess the AI’s gameplay effectiveness and refine its strategies based on performance metrics.
FAQ
- What is the main objective of the AI in the game?
The AI aims to reach the finish line quickly and safely by following light signals. - How does the AI know when to move or stop?
The AI perceives the current light state, moving during green light and stopping during red light. - What learning strategy can be used for the AI?
Reinforcement learning is suitable, allowing the AI to improve through practice and feedback. - What happens if the AI moves during red light?
The AI incurs penalties, prompting it to adjust its behavior to avoid future mistakes.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


