Make a browser game with AI (no coding): snake game prompt

Describe a snake game in plain words and the AI builds it. It plays right in your browser with nothing to install, and you can send it to friends as a link.

For: Parents who want to build a simple game with their kids, or anyone making something with AI for the first time

Tools
Claude (web & app), ChatGPT, Claude Code
Time
20 min
Difficulty
Easy
Cost
Works on a free account

What you need

  • A computer (the game uses the keyboard, so a computer is easiest)
  • A free Claude account (claude.ai) or a free ChatGPT account
  • No software to install

What you get

A snake game you control with the arrow keys or by swiping on a phone. Eating food raises your score, and the game remembers your best score. The demo below is the exact result of this prompt.

Snake demo. Runs right here on the page.Open in new tab

Step by step

  1. 1

    Go to claude.ai and sign in

    Open claude.ai in your browser. Sign up for free with a Google account or an email address, then sign in. To use ChatGPT instead, sign in at chatgpt.com.

    You know it worked whenYou are ready when you see a chat box at the bottom of the screen.

  2. 2

    Paste the prompt and send it

    Copy the prompt below, paste it into the chat box, and press Enter (or the send button). If you want different colors or a different theme, edit the prompt before sending.

    Prompt to paste
    Make a snake game that I can play right in my browser. Put everything in a single file.
    
    - The snake moves on a board made of square cells
    - Arrow keys move it on a computer. On a phone, swipe the screen. Also add direction buttons below the board
    - Eating food raises the score and makes the snake longer. The game gets a little faster with each piece of food
    - Remember the best score so it still shows the next time I open the game
    - Pressing the space bar pauses the game
    - Hitting a wall or the snake's own body ends the game and shows a "Play again" button
    - Dark navy background, blue snake, yellow food
    - All text in the game should be in English

    Make it yours

    • Change the colors (background, snake, food) to ones you like.
    • For young kids, add one line: "Start very slowly."
    • Swap the snake for a cat, a train, or anything else you like.
    Want more control? (a slightly more technical version)
    Make a snake game as one self-contained HTML file.
    - 18x18 grid drawn on a canvas
    - Support both arrow keys and mobile swipe, plus on-screen direction buttons
    - Speed up slightly with each piece of food
    - Save the best score in localStorage
    - Space bar pauses; the game-over screen has a restart button
    - Dark background (#15192b), blue snake, yellow food
    - No external libraries
    - All UI text in English

    You know it worked whenAfter a few dozen seconds, Claude opens a separate result panel on the right and the game appears in it.

    TipChatGPT may print a long block of code. If it does, say "Don't show me the code. Show it so I can play it right away (use Canvas)."

  3. 3

    Play it in the result panel

    Click once on the game inside the result panel. Then press the arrow keys and the snake moves. Eat the food (the yellow square) to raise your score.

    You know it worked whenIf the snake follows your arrow keys and the score goes up, it works.

    TipIf the arrow keys do nothing, click the game once. The keyboard input was going somewhere else on the page.

  4. 4

    Change it by asking

    Type anything you do not like into the chat and the game changes right away. Ask for one change at a time. It is more accurate that way.

    TipTry things like "Let the snake pass through walls and come out the other side", "Add a few obstacle blocks", "Start slower", or "Make the score text bigger".

  5. 5

    Check that the best score is saved

    Play until you have a score, then refresh the page. Check that your best score is still there.

    You know it worked whenIf the best score is still shown after a refresh, it works.

    TipIf the score disappears, you may be in a private (incognito) window, or your browser clears site data on exit. Try a normal window.

  6. 6

    Turn it into a link and send it to a friend

    Click Publish at the top right of the result panel to get a public link. Copy it and paste it into WhatsApp or any chat. The person who opens it plays right away without signing up. For the full steps, see "Share it as a link" below.

    You know it worked whenSend the link to yourself in a chat. If the game opens when you tap it, you are done.

Share it with a link

  • No photos or forms? Make it in Claude on the web and press Publish on the artifact. Anyone can open the link without an account.
  • Photos or forms? Save the code as index.html in a folder with your photos and drag the whole folder onto app.netlify.com/drop. Sign up for free to make the link public.
See it screen by screen

If you get stuck

The result panel does not appear on the right

If the chat only shows a long block of code, say "Show it in the result panel." If that does not work, start a new chat and send the prompt again.

The snake does not move when I press the arrow keys

Click the game once with your mouse, then press the arrow keys. Until you click, keyboard input does not reach the game.

Swiping on my phone does not move the snake

Use the direction buttons below the board. If those do not work either, say "Swiping does not work on my phone. Fix it." The most reliable test is to publish the link and open it on your phone.

The best score is not saved

Saving can be blocked in private windows and in the small built-in browsers inside apps. Open the link in a normal Chrome or Safari window.

The game is too hard or too fast

You can describe it by feel instead of numbers, for example "Cut the starting speed in half and make it speed up less."

Try next

  • Try a game with clear rules next, like Tetris or 2048. For games with long rules, split the request: "First just the basic rules, then the scoring."
  • Building with Claude Code in the terminal makes it easier to work with files and keep refining. It is fine to wait until you are comfortable.

Features used here

/artifactsOpens artifacts you made and artifacts shared with you, or attaches them to the session.Claude CodeCommandsfrontend-designBuilds polished frontend UI that avoids the generic AI look.Claude CodePlugins

More recipes

All recipes

Written in November 2026. App screens change, so menu names are described in general terms. People and data in examples are fictional. How we write