Skip to content

lichaozhao/snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

A fun demo of Github Copilot Chat

Using below prompts to write a snake game in JavaScript.

Prerequisites

  1. Install VS Code to you computer and install Github Copilot & Github Copilot Chat extension.
  2. Get Github Copilot for business account. please ask your GH Copilot administrator to get it.
  3. Get basic knowledge of large language model.

The marjor steps to write a snake game

  1. Create a folder of snake-game and open it in VS Code.
  2. Commuicate with Github Copilot Chat to get the snake game done. you can tell Copilot Chat what you want to do and Copilot Chat will give you the code.

The sample prompts to write a snake game.

Open the folder of snake-game in VS Code and using below prompts to communicate with Copilot Chat.

You will get the initial code, please copy these code to a new file. Copilot Chat will tell you more details.

what is snake game? 
create the code of snake game in JavaScript. 
how can I call this code 

Using bellow prompts to add more features into your game. please adjust the prompt according the feature you want to build.

how do i add a border to this canvas 
make the game even prettier
how do i center the canvas
how do i make the snake go through the wall
how do i add touch controls
how do i stop the page scrolling
how to add obstacles in the game
how to detect collision between snake and obstacles

Due to Copilot Chat is based on LLM, so every single time generated code may be not exactly same even you are using the same prompts. Here are some other prompts that maybe helpful.

i tested the code you give me, the food is not aligned with the snake exactlly.
i want to show the scrore part outside of the game, just at the buttom of the game
how to control the snake by swiping the screen
the score is not updated
how to restart the game using enter key as game is over

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published