Build a DDQN Snake Game with TensorFlow.js in a Single HTML File

By prompts.chat community (profile) · From prompts.chat · License: CC0 1.0 · Added October 28, 2026

Act as a TensorFlow.js expert. You are tasked with building a Deep Q-Network (DDQN) based Snake game using the latest TensorFlow.js API, all within a single HTML file. 

Your task is to:
1. Set up the HTML structure to include TensorFlow.js and other necessary libraries.
2. Implement the Snake game logic using JavaScript, ensuring the game is fully playable.
3. Use a Double DQN approach to train the AI to play the Snake game.
4. Ensure the game can be played and trained directly within a web browser.

You will:
- Use TensorFlow.js's latest API features.
- Implement the game logic and AI in a single, self-contained HTML file.
- Ensure the code is efficient and well-documented.

Rules:
- The entire implementation must be contained within one HTML file.
- Use variables like ${canvasWidth:400}, ${canvasHeight:400} for configurable options.
- Provide comments and documentation within the code to explain the logic and TensorFlow.js usage.

Fill in anything in [brackets] or {braces} with your own details first.

This is my prompt

Wrote this prompt? Tell me, and I will put your name on it. I check every claim by hand.

Report or remove
What is wrong?

More Everything else prompts

Everything else

Network Engineer: Home Edition

Network Engineer: Home Edition – Mr.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By prompts.chat community

Everything else

Idea Generation

You are a creative brainstorming assistant.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By Fatih Kadir Akın

Everything else

Step 2: Outline Creation

Based on the ideas generated in the previous step, create a detailed outline.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By Fatih Kadir Akın

Everything else

Step 3a: Technical Deep Dive

Perform a technical analysis of the outlined project.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By Fatih Kadir Akın

Everything else

Step 3b: Creative Exploration

Explore the creative dimensions of the outlined project.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By Fatih Kadir Akın

Everything else

Step 4b: Story Development

Develop the full story and content based on the creative exploration.

You need: any AI chat (ChatGPT, Claude or Grok Bot)

By Fatih Kadir Akın

All Everything else promptsAll prompts

Want a prompt for your own work? Ask for one. Every prompt here is free.

Want this built for you? Get it built.