GithubHelp home page GithubHelp logo

snake's Introduction

Snake gameplay

Snake game written in ANSI C

Everyone knows what the snake game is: You eat food, the line/snake grows bigger. There is not much else to it, you can read the Wikipedia article if you want more information. In particular, this version of Snake has the "snake", warping and multiple food.

I usually use this project as "testing grounds" for a new platform or development environment since its easily portable and I know its behavior very well, so if something goes very wrong its immediately noticeable.

Building

An ANSI C / C89 compliant compiler is needed, a C++ compiler works as well since this code is written with the -Wc++-compat compiler flag in mind, the only dependencies for this project are libc and SDL.

To compile you can simply do cc -I/usr/include/SDL2 -lSDL2 src/snake.c src/main.c on most systems. For more ellaborated building or development, you should use Meson.

Support to build with emscripten is provided! Assuming you have the toolchain in PATH already you can get started with:

meson setup --cross-file wasm-cross.ini build-emscripten && cd build-emscripten
meson compile
# Remember that you need a server to deliver the .wasm / .js files!
python -m http.server

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.