Code Monkey home page Code Monkey logo

snakeprogram's Introduction

Snake Game ๐Ÿ

Welcome to the Snake Game project! This is a simple yet entertaining Snake Game, written in C++. This Readme file will guide you through building and running this game.

Table of Contents

Project Structure

The project contains the following files:

.
โ”œโ”€โ”€ main.cpp          # Main program file
โ”œโ”€โ”€ game.cpp          # Source file related to the game logic
โ”œโ”€โ”€ game.h            # Header file related to the game logic
โ”œโ”€โ”€ fruit.cpp         # Source file related to the fruit
โ”œโ”€โ”€ fruit.h           # Header file related to the fruit
โ”œโ”€โ”€ snake.cpp         # Source file related to the snake
โ”œโ”€โ”€ snake.h           # Header file related to the snake
โ”œโ”€โ”€ vector2.h         # 2D Vector class for representing coordinates
โ”œโ”€โ”€ input.cpp         # Source file for handling user input
โ”œโ”€โ”€ input.h           # Header file for handling user input
โ””โ”€โ”€ CMakeLists.txt    # CMake configuration file

Prerequisites

  • C++17 Compiler: Make sure you have a C++ compiler that supports C++17.
  • CMake: Version 3.20 or higher is required. You can download it from the official website.

Building Instructions

  1. Clone or download this repository to a local directory.

    git clone https://github.com/yourusername/snakeprogram.git
    cd snakeprogram
  2. Create a build directory and navigate into it.

    mkdir build
    cd build
  3. Run CMake to configure the project.

    cmake ..
  4. Build the project using CMake or your compiler.

    cmake --build .

Running Instructions

After building, you can find an executable named snakeprogram in the build directory. Run it from the command line to start the game:

./snakeprogram

Gameplay Instructions

  • Use the arrow keys to control the direction of the snake.
  • Eating fruits makes the snake grow longer.
  • The game ends if the snake hits the wall or itself.
  • Try to achieve the highest score possible by eating as many fruits as you can without dying.

๐Ÿš€ Enjoy the game!

snakeprogram's People

Contributors

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