Git Product home page Git Product logo

console_snake's Introduction

Console Snake

Lei Mao

Introduction

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.

Dependencies

Files

.
├── audios
│   └── bgm.wav
├── CMakeLists.txt
├── demo
│   ├── console_snake_demo.gif
│   ├── console_snake_demo.mp4
│   └── mp42gif.sh
├── LICENSE.md
├── modules
│   └── Console_Player
├── README.md
└── src
    ├── CMakeLists.txt
    ├── game.cpp
    ├── game.h
    ├── main.cpp
    ├── snake.cpp
    └── snake.h

Installation

Installation of CMake

Check out the installation guide from Kitware.

Installation of Dependencies

$ sudo apt-get install libncurses-dev libsndfile-dev libasound2-dev

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

Usages

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.

Demo

Console Snake Demo

For full demo with sound, please click the demo image and watch the YouTube video.

Feedbacks

If you have encountered any bug, or have any suggestions for improvements, please open an issue ticket in the repository.

References

To-Do List

  • Add leader board
  • Add background music
  • Allow user to save player name to the leader board

console_snake's People

Contributors

leimao avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.