Git Product home page Git Product logo

snake's Introduction

Snake

Neural Networks playing snake game trained by genetic algorithm

A personal project made by Robin Mancini and myself, consisting in training neural networks to play the game "Snake"

This repository contains:

  • The Snake Game itself
  • A Genetic Algorithm module
  • A Neural Network module
  • A main file with toy examples

I timed most functions to be sure to improve speed and used numba jit for compiling some functions, the genetic algorithm is parallelized for its main part (snakes evaluation) using multiprocessing and joblib

Installation

Python 3 was used for this project and I can't promess that older versions are compatibles

Libraries you'll need to run the project:

{joblib, numpy, numba, pygame}

Clone the repo using

git clone https://github.com/valentinmace/snake.git

Usage

You will find some ready to run examples in main.py file.

You can try to:

  • Play snake
  • Train your own neural networks (it can take a while to get good results)
  • Display a game played by neural networks that I trained and selected four you

Everything is explaind in the file, just uncomment parts that you want to execute, then go to terminal and do:

python main.py

Notes

Do not hesitate to contact me if you need some help

Everything is made by me, I did not want to use existing framework for the genetic algorithm or neural network for learning purposes. I also coded the game with performance in mind rather than conception elegance.

I have published (or will publish depending on when you read this) a serie of youtube tutorial videos on my channel (in french)

Meta

Valentin Macé – LinkedInYouTubeTwitter - [email protected]

Distributed under the MIT license. See LICENSE for more information.

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.