Skip to content

A snake game to be played manually or to be tested against a neural network algorithm. The neural network is configurable on the ui. Extended statistics about game data can be provided via webserver interface. Additionally, a demo mode with a trained neural network is implemented.

Notifications You must be signed in to change notification settings

lpapailiou/SnakeML

Repository files navigation

Snake ML

A snake game which can be played by using a neural network.
Created as FFHS project in fall 2020 in collaboration with @ramonator00 and @SandroBuerki.

Table of Contents

  1. About the game
  2. Implemented AI
  3. Project structure
  4. How to get it

About the game

screenshot of snake

Following modes are available:

  • arcade mode (classic manual gameplay)
  • neural network mode (configure a neural network and see what happens)
  • demo mode (trained neural network)

Additional features:

  • extended statistics, available by browser via webserver
  • various themes available

Available key commands:

Key Command
UP, W set direction of next move to 'up'
(manual mode only)
RIGHT, D set direction of next move to 'right'
(manual mode only)
DOWN, S set direction of next move to 'down'
(manual mode only)
LEFT, A set direction of next move to 'left'
(manual mode only)
SPACE, ENTER start or stop a game
V 'verbose': activate/deactivate real time statistics
(neural network mode only)
P 'position': changes position of real time statistics
(neural network mode only)

Implemented AI

The neural network was implemented by using a genetic algorithm.

Project structure

  • ai                     here, all ai related code is in
  • game                 the basic game loic
  • main                 this package contains the main method (in Main.java), configuration and game mode handling
  • ui                 all ui related code
  • webserver         all webserver related code

How to get it

Clone the repository with:

git clone https://github.com/lpapailiou/snakeML your-target-path

For further help, click here.

About

A snake game to be played manually or to be tested against a neural network algorithm. The neural network is configurable on the ui. Extended statistics about game data can be provided via webserver interface. Additionally, a demo mode with a trained neural network is implemented.

Topics

Resources

Stars

Watchers

Forks