- Fetch the repo
git clone https://github.com/abhishekraj272/snake-terminux.git
- Download the dependencies
cd snake-terminux
go mod download
- Starting the game
go run main.go
- Use arrow keys to move your snake.
- Press q, esc, Ctrl+C or Ctrl+D to quit the game.
- Hitting the wall or snake itself means GAME OVER.
- Eat food to increase score and length of snake.
- Chosen
termbox-go
for better UI/UX. - Ran
termbox.PollEvent
on a GoRoutine to detect key press and usedGo Channels
to share data between GoRoutine. - Created a Game object to store all required data, and created methods for all logics.
- Created a 2d Array to represent board where, 0 means blank-space, 1 means snake and 2 means food.
- Snake moves by moving its head coords and removing its tail.
- When snake eats food, its tail is increased.
- Ubuntu 20.04 LTS
Time taken on this project 4-5hrs Max