웹 브라우저에서 동작하는 강화학습(DDQN) AI 스네이크 게임을 단일 HTML 파일로 개발하고 싶을 때.
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.TensorFlow.js 전문가 역할을 수행해 주세요. 당신의 임무는 최신 TensorFlow.js API를 사용하여 단일 HTML 파일 내에 더블 심층 Q-네트워크(DDQN) 기반의 스네이크 게임을 구축하는 것입니다.
당신의 작업:
1. TensorFlow.js 및 기타 필요한 라이브러리를 포함하도록 HTML 구조를 설정하세요.
2. JavaScript를 사용하여 완전히 플레이 가능한 스네이크 게임 로직을 구현하세요.
3. Double DQN 방식을 사용하여 AI가 스네이크 게임을 플레이하도록 학습시키세요.
4. 웹 브라우저 내에서 직접 게임을 플레이하고 학습시킬 수 있도록 하세요.
지시사항:
- TensorFlow.js의 최신 API 기능을 사용하세요.
- 단일 독립형 HTML 파일 내에 게임 로직과 AI를 구현하세요.
- 코드가 효율적이고 주석이 잘 작성되어 있는지 확인하세요.
규칙:
- 전체 구현은 하나의 HTML 파일 내에 포함되어야 합니다.
- 설정 가능한 옵션에는 ${canvasWidth:400}, ${canvasHeight:400}과 같은 변수를 사용하세요.
- 로직과 TensorFlow.js 사용법을 설명하는 주석과 설명을 코드 내에 제공하세요.출처 · prompts.chat · Build a DDQN Snake Game with TensorFlow.js in a Single HTML File — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.
Gemini로 프롬프트를 실행해 생성한 화면입니다. 화면 안에서 직접 조작하실 수 있습니다.
TensorFlow.js를 활용하여 브라우저에서 실시간으로 학습하고 플레이하는 Double DQN(DDQN) 기반 뱀게임 시뮬레이터를 구축했습니다. 세련된 대시보드 UI를 통해 에피소드 수, 탐험율(Epsilon), 손실(Loss), 실시간 Q-값 및 보상 통계를 직관적으로 확인하고 직접 조종하거나 학습 속도를 조절할 수 있습니다.
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 width 400px, height 400px for configurable options. - Provide comments and documentation within the code to explain the logic and TensorFlow.js usage.
Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).
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 width 400px, height 400px for configurable options. - Provide comments and documentation within the code to explain the logic and TensorFlow.js usage.
TensorFlow.js를 활용하여 브라우저에서 실시간으로 학습하고 플레이하는 Double DQN(DDQN) 기반 뱀게임 시뮬레이터를 구축했습니다. 세련된 대시보드 UI를 통해 에피소드 수, 탐험율(Epsilon), 손실(Loss), 실시간 Q-값 및 보상 통계를 직관적으로 확인하고 직접 조종하거나 학습 속도를 조절할 수 있습니다.
원문과 같은 언어로 보완한 프롬프트입니다. 점수는 명확성 · 구체성 · 출력 형식 · 재사용성 기준의 AI 평가입니다.
Act as a senior TensorFlow.js expert. Your task is to build a complete, self-contained Double Deep Q-Network (DDQN) Snake game in a single HTML file. Context & Setup: - Target Environment: Modern Web Browsers using the latest TensorFlow.js via CDN. - Include configurable options using placeholders: canvas width `[CANVAS_WIDTH: 400]`, canvas height `[CANVAS_HEIGHT: 400]`, learning rate `[LEARNING_RATE: 0.0005]`, and replay buffer capacity `[BUFFER_SIZE: 10000]`. Key Requirements: 1. Game Logic: Implement standard Snake game rules on an HTML5 canvas (movement, collision, food generation). 2. DDQN Architecture: - State & Action: Define explicit state vectors (relative position to food, obstacle directions) and action spaces. - Model & Replay: Build main and target Q-networks, an experience replay buffer, and epsilon-greedy exploration. - Reward Design: Specify distinct positive/negative rewards for eating food, collision, and surviving steps. 3. UI & Controls: Display live stats (Episode, Loss, Score, Epsilon) and add buttons for toggling AI Training vs Manual Play. Output Format: Provide the complete, fully functional, and well-commented HTML code inside a single code block with no conversational text outside.