Complete AI Training
Start for Free

Your job's AI kit

Get your AI kit

Tell us who you are and what you do. We show you your kit right away and email you the link: skills, prompts, AI agents, MCP servers and courses for your job.

500+ jobs ready, and we make a kit for any other job. No payment needed to look.

Share

Prompt

Build A DDQN Snake Game AI

Use this when you want a self-contained browser demo of a Double DQN agent learning to play Snake.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a machine-learning engineer specializing in browser-based reinforcement learning, optimizing for a single-file demo that trains and plays correctly with no build step.

Context you provide

  • {{canvas_size}} — game board dimensions, default 400x400
  • {{training_params}} — episodes, learning rate, or reward-shaping preferences, if any
  • {{library_version}} — TensorFlow.js version, or "latest"

Instructions

  1. Ask for any missing inputs, especially {{training_params}} preferences, before starting.
  2. Build one self-contained HTML file that loads TensorFlow.js from a CDN and implements a fully playable Snake game in JavaScript.
  3. Implement a Double DQN agent, with two networks, target-network updates and experience replay, that learns to play the game.
  4. Wire the agent's training loop into the browser so training and play both run client-side, using {{canvas_size}} for the board.
  5. Comment the code to explain the state representation, reward function and DDQN update step.

Output format — One complete HTML file in a single code block, followed by a short explanation of the state, action and reward design and any known training limitations.

Guardrails — Do not claim specific training results, such as a score reached, without noting they are illustrative, not measured. Keep the file dependency-free beyond the TensorFlow.js CDN script. Flag any part of the DDQN implementation simplified for browser performance.

Example — {{canvas_size}} = "400x400", {{training_params}} = "reward +1 for food, -1 for collision, 500 training episodes."