Skip to content

OPC-16/Snake-in-Ncurses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake

Snake is a simple game build with help of Ncurses.

Ncurses is a programming library providing an API that allows us to write text-based user interfaces in a terminal-independent manner. The package libncurses5-dev needs to be installed in order to use ncurses.

Screenshot

snake-game

Code

Code is simple and easy to understand.

  • game.hpp - contains the main logic, initializes the board, updates the state, processes the user-input, creation & destruction of 'apple', placing next snake piece.
  • board.hpp - constructs centered board for snake, adding of chars and getting input from user.
  • scoreboard.hpp - initialization, display and updation of scoreboard.
  • drawable.hpp - implements class which can display anything on board having x, y & icon values.
  • apple.hpp - inherits drawable class and represents apple on board.
  • empty.hpp - inherits drawable class and represents an empty space on board.
  • snake.hpp - implements snake, its direction and gives position of next head of snake.

Dockerfile

Dockerfile is a single stage build, while Dockerfile.multistage is a multi-stage build.
Remember: to play the game we need to run the image interactively, i.e. docker run -it <image-name>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published