Code Monkey home page Code Monkey logo

snake-game's Introduction

Snake game

Description of the game:

Control the snake to eat fruits and avoid obstacles and its own body.
The snake will grow longer when it eats a fruit.
The more fruits the snake eats, the higher score you will receive.
The gaps on the border let the snake wrap around to other side of the screen.
Add obstacles inside the map.
Add gaps on the border that lets the snake wrap around to other side of the screen.

Start game:

Use "make run" to compile and run snake.cpp
Or use "make" to compile snake.cpp, and use "./snake" to run the game.

Command-line parameters:

"./snake xx"
Use 1 parameter to input frame-rate(in range of [1, 100]), and the default game speed is 5.

"./snake xx xx"
Use 2 parameters to input frame-rate and game speed.
First one should be frame-rate(in range of [1, 100]).
Second one should be game speed(in range of [1, 10]).

The controls:

Press k/K to start the game at the splash screen.
Use w/W/a/A/s/S/d/D or arrows keys to control the direction of the snake.
Use r/R to restart.
Use p/P to pause.
Use q/Q to quit the game.

The development environment:

macOS High Sierra version 10.13.4
gcc (MacPorts gcc5 5.5.0_1) 5.5.0
Sublime 3.1.1 (BUILD 3176)

Screenshots

Alt text
Alt text
Alt text

snake-game's People

Contributors

chenli0111 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.