- Make sure you have Python 3 installed.
- Open a terminal in this folder and run:
python server.py - Open your browser and go to http://localhost:8000.
- Use the arrow keys to move the snake.
- Eat the red food to grow and increase your score.
- The game ends if you hit the wall or yourself.
- Click "Restart" to play again.
Enjoy!
- Install Node.js from nodejs.org.
- Open a terminal in this folder and run:
npx create-react-app snake-react cd snake-react - Replace the contents of
src/App.jsandsrc/App.cssas shown below. - Start the development server:
npm start - The game will open at http://localhost:3000.
- Use the arrow keys to move the snake.
- Eat the red food to grow and increase your score.
- The game ends if you hit the wall or yourself.
- Click "Restart" to play again.