프롬프트 도감 › No.2008
AI가 배우는 스네이크 게임
DDQN Snake Game
HTML 파일 하나로 브라우저에서 바로 하는 스네이크 게임이 나와요. AI가 직접 게임을 하면서 배우는 과정도 볼 수 있어요.
이럴 때 강화학습 공부, 코딩 연습, 브라우저 게임 만들기
도구 ChatGPT · Claude · Gemini
프롬프트
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.팁
- 캔버스 크기는 ${canvasWidth} 값으로 바꿔요
- 저장한 html 파일을 브라우저로 열어요
출처
권리: CC0 (f/prompts.chat). 자유 사용. 기여자: [email protected].