Coder Social home page Coder Social logo

turning-snake's Introduction

Did you really need to make that turn?

A simple Snake-like game with a twist in 120 lines of F#

by Andreas From

Gameplay

You move the blue "snake" around with the arrow keys. Everytime you turn you add a "mine" that will kill you if you touch it. You can wrap around the screen so you only have to watch out for the mines. If you touch them, you get to see your final score and then the game starts over.

The objective is to get as high a score as possible by collecting "apples". Red apples are worth 1 point and green apples 3 points. They don't have any effect except increasing your score which you can see in the topleft corner.

Have fun!

Image of the gameplay

Code

I wanted to learn F# so I decided to write a simple game using Winforms. The snake moves around on a 60 by 40 grid which I draw ten times larger. This simplifies collision detection to simply comparing points.

The game loop is run asynchronously and the main loop is used to get key events.

Download

Playing the game requires either the F# 2.0 Runtime for Windows or Mono for Mac and Linux with support for F# 2.0.

Then you should be able to download and run Snake.exe

turning-snake's People

Contributors

astahfrom avatar

Stargazers

Rishav Sharan avatar Aleksey Z avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

albert777

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.