Giter Site home page Giter Site logo

snake's Introduction

Welcome to Snake - your classic Snake game as a console app.

Written in .NET Core 3.1

Quick Start Guide

Valid keys are arrow keys ← ↑ → ↓ or WASD. The inputs are queued (you can delete queue by pressing 'C')
You win when the entire screen is filled with snake.
When game is over, you will see your snake's length.

You grow by eating apples, denoted as 'a'. You snake head will be marked with 'H' and the rest of the body will be marked as 'S'.
You snake will warp around the edges by default.

You may pass command line parameters / change source code config to control various configurations.
Use --help for more info.

The default game world size is current console size and will use max size if not supported. Full-screen may cause flickers.
Set verbose mode to get relevant information, after game is over.

Quick Project Explanation

Split into "Core" class library that has the world class.
And then the "Snake" console project, that deals with input + rendering + extra UI logic.

Both have configurable Options class. The rest you may read the code / ask me through issues.

Features

  • Smooth inputs
    • Inputs are queued.
    • WASD and ArrowKey boths are supported
  • Amazing configuration
    • (Almost)Every defaults are changable using command line options or source code, powered by CommandLineParser. If there is one you want to change, feel free to send a pull request. Examples are -
      • How many seconds should the game wait between each update / render
      • X and Y size of the world of the game
      • Apple's X and Y coordinate.
      • You can set a seed so that the randomness is reconstructable (assuming your snake is in the same position)
        • You know exactly where the apple will spawn
      • Verboseness so you know which random seed you played
    • Project is split into Core and UI part, meaning I could reuse the Core part in any project I want to port to In this case, I can reuse it to make a cross-platform game using monogame.
  • Forgiving AI
    • Apple is much more likely to spawn around you.

TODO

  • Add color
  • Port to MonoGame
  • Add more gameplay such as quick apple bonus.

Known Bugs (features?)

  • Only starting snake location can't be controlled as of now using config

Thank you for trying this out.

snake's People

Contributors

waiyanmyintmo avatar

Stargazers

 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.