All Projects → leimao → Console-Snake

leimao / Console-Snake

Licence: MIT license
Snake Game in Console Implemented Using C++

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to Console-Snake

snake-neural-network
An experiment with neural network and genetic algorithms
Stars: ✭ 68 (-31.31%)
Mutual labels:  snake-game
Q-Snake
A Q-learning web visualizer for Snake built with React
Stars: ✭ 34 (-65.66%)
Mutual labels:  snake-game
Training-Snake-Game-With-Genetic-Algorithm
training snake game using neural network and genetic algorithm
Stars: ✭ 28 (-71.72%)
Mutual labels:  snake-game
snake game
This is a simple implementation of the classic snake game in rust
Stars: ✭ 16 (-83.84%)
Mutual labels:  snake-game
wxgame-snake
🐍 微信小程序游戏,贪吃蛇
Stars: ✭ 20 (-79.8%)
Mutual labels:  snake-game
snake-reinforcement-DNN
Developing a deep neural network to play a snake game
Stars: ✭ 12 (-87.88%)
Mutual labels:  snake-game
Snake-Game-with-Deep-learning
Developing a neural network to play a snake game
Stars: ✭ 43 (-56.57%)
Mutual labels:  snake-game
snake-pygame
🐍 A snake game written in Python using the Pygame library
Stars: ✭ 42 (-57.58%)
Mutual labels:  snake-game
snake-js
Nostálgico jogo da 🐍 em JavaScript.
Stars: ✭ 24 (-75.76%)
Mutual labels:  snake-game
snake-game-p5
The Snake Game made with p5.js 🐍🎮.
Stars: ✭ 18 (-81.82%)
Mutual labels:  snake-game
openNES-Snake
Simple rebuilt of the classic Snake game for the NES in C using the cc65 cross compiler.
Stars: ✭ 18 (-81.82%)
Mutual labels:  snake-game
snake
A terminal interface for Snake
Stars: ✭ 51 (-48.48%)
Mutual labels:  snake-game
SnakeClassic
A snake engine written in SpriteKit for all Apple devices.
Stars: ✭ 56 (-43.43%)
Mutual labels:  snake-game
Snakes
A simple game of snakes implemented in C++ and OpenCV
Stars: ✭ 24 (-75.76%)
Mutual labels:  snake-game
arduino-snake
Snake game for Arduino
Stars: ✭ 25 (-74.75%)
Mutual labels:  snake-game
snake-game-2D
The famous 2D snake game in which your goal is to eat until you get huge and accumulate many points.
Stars: ✭ 18 (-81.82%)
Mutual labels:  snake-game
snake
Basic Snake Game in TypeScript
Stars: ✭ 25 (-74.75%)
Mutual labels:  snake-game
Cpp-Snake
A simple snake game written in c++
Stars: ✭ 35 (-64.65%)
Mutual labels:  snake-game
snk
🟩⬜ Generates a snake game from a github user contributions graph and output a screen capture as animated svg or gif
Stars: ✭ 844 (+752.53%)
Mutual labels:  snake-game
NESnake
Snake game for Nintendo NES written in C
Stars: ✭ 16 (-83.84%)
Mutual labels:  snake-game

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

Build Docker Image

$ docker build -f docker/snake.Dockerfile --no-cache --tag=snake:0.0.1 .

Run Docker Container

$ docker run -it --rm --device /dev/snd -v $(pwd):/mnt snake:0.0.1

Install CMake

Check out the installation guide from Kitware.

Install Dependencies

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

Install 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
$ cmake -B build
$ cmake --build build --target install --config Release

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.

Play Game Using Default BGM

$ cd bin/
$ ./main

Play 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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].