Lei Mao bio photo

Lei Mao

Machine Learning, Artificial Intelligence, Computer Science.

Twitter Facebook LinkedIn GitHub   G. Scholar E-Mail RSS


The Console Snake game with background music was implemented using C++ and the libraries libncurses and libcplayer. libncurses (new curses) is a programming library providing an application programming interface (API) that allows the programmer to write text-based user interfaces in a terminal-independent manner. libcplayer(console player) is a C++ library for playing background audios asynchronously in C++ programs.



Installation of Dependencies

$ sudo apt-get install libncurses-dev cmake

Installation of the Game

Because the installation requires to use git submodule, please git clone instead of download the repository.

$ git clone https://github.com/leimao/Console_Snake.git
$ cd Console_Snake
$ git submodule update --init --recursive
$ mkdir -p build
$ cd build
$ cmake ..
$ make
$ make install


Game Rules

Control the snake to eat food as much as possible. You get one point for every food your snake eat. The level of difficulty would increase every 5 points you get.

Playing the Game Using Default BGM

$ cd bin/
$ ./main

Playing the Game Using Custom BGM

The user is also allowed to use custom BGMs.

$ cd bin/
$ ./main [bgm_sound_file]

Currently the game only supports wav, ogg, and flac audio formats.