Giter VIP home page Giter VIP logo

snakegame's Introduction

Snake Game using C++

This is a simple console-based Snake Game implemented in C++. The game allows the player to control a snake, represented by the character 'O', with the objective of eating fruits ('F') while avoiding collisions with the walls and the snake's own tail.

Instructions:

  1. Compilation:

    • The code is written in C++ and can be compiled using a C++ compiler (e.g., g++ for Linux, MinGW for Windows).
    • Ensure that the necessary header files and libraries are available.
  2. Controls:

    • Use the following keys to control the snake:
      • 'W' or 'w': Move Up
      • 'S' or 's': Move Down
      • 'A' or 'a': Move Left
      • 'D' or 'd': Move Right
      • 'M' or 'm': Quit the game
  3. Game Rules:

    • The snake should not collide with the walls or its own tail.
    • Eating a fruit increases the score by 10 points.
    • The game speed increases as the player's score reaches certain milestones.
  4. High Score:

    • The game maintains a high score, which is stored in the "scores.txt" file.
    • If a player sets a new high score, they are prompted to enter their name.

How to Play:

  1. Run the Game:

    • Compile and run the source code.
    • The game will display instructions and rules on the console.
  2. Playing the Game:

    • Control the snake using the specified keys.
    • Eat fruits to increase your score.
    • Avoid collisions with walls and your own tail.
  3. Game Over:

    • The game ends when the snake collides with the walls or its own tail.
    • The final score is displayed along with the high score.
  4. Restart or Quit:

    • After each game, you can choose to play again or quit.
    • Type "yes" to play again or "no" to exit.

Notes:

  • The game uses the console for input and output.
  • The code utilizes C++ features such as file handling, random number generation, and basic input/output operations.
  • Make sure to set up the development environment with the necessary dependencies before compiling the code.

snakegame's People

Contributors

mohith-o07 avatar

Watchers

 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.