All Projects → aliakbar09a → Ai_plays_snake

aliakbar09a / Ai_plays_snake

Licence: mit
AI trained using Genetic Algorithm and Deep Learning to play the game of snake

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Ai plays snake

Rlcard
Reinforcement Learning / AI Bots in Card (Poker) Games - Blackjack, Leduc, Texas, DouDizhu, Mahjong, UNO.
Stars: ✭ 980 (+615.33%)
Mutual labels:  ai, reinforcement-learning
Notebooks
Some notebooks
Stars: ✭ 53 (-61.31%)
Mutual labels:  reinforcement-learning, genetic-algorithm
Evolutionary Neural Networks On Unity For Bots
Neural networks + Genetic algorithm on unity
Stars: ✭ 38 (-72.26%)
Mutual labels:  ai, genetic-algorithm
Awesome Ai Books
Some awesome AI related books and pdfs for learning and downloading, also apply some playground models for learning
Stars: ✭ 855 (+524.09%)
Mutual labels:  ai, reinforcement-learning
Cartpole
OpenAI's cartpole env solver.
Stars: ✭ 107 (-21.9%)
Mutual labels:  ai, reinforcement-learning
Evolutionary Algorithm
Evolutionary Algorithm using Python, 莫烦Python 中文AI教学
Stars: ✭ 881 (+543.07%)
Mutual labels:  reinforcement-learning, genetic-algorithm
Holodeck Engine
High Fidelity Simulator for Reinforcement Learning and Robotics Research.
Stars: ✭ 48 (-64.96%)
Mutual labels:  ai, reinforcement-learning
Super Mario Bros A3c Pytorch
Asynchronous Advantage Actor-Critic (A3C) algorithm for Super Mario Bros
Stars: ✭ 775 (+465.69%)
Mutual labels:  ai, reinforcement-learning
Reinforcement Learning Wechat Jump
Reinforcement Learning for WeChat Jump
Stars: ✭ 85 (-37.96%)
Mutual labels:  ai, reinforcement-learning
Cross Adaptive Audio
Evolving Artificial Neural Networks for Cross-Adaptive Audio Effects
Stars: ✭ 82 (-40.15%)
Mutual labels:  ai, genetic-algorithm
Construct
JavaScript Digital Organisms simulator
Stars: ✭ 17 (-87.59%)
Mutual labels:  ai, genetic-algorithm
Snake Ai Reinforcement
AI for Snake game trained from pixels using Deep Reinforcement Learning (DQN).
Stars: ✭ 123 (-10.22%)
Mutual labels:  ai, reinforcement-learning
Pygame Learning Environment
PyGame Learning Environment (PLE) -- Reinforcement Learning Environment in Python.
Stars: ✭ 828 (+504.38%)
Mutual labels:  ai, reinforcement-learning
Ai Programmer
Using artificial intelligence and genetic algorithms to automatically write programs. Tutorial: http://www.primaryobjects.com/cms/article149
Stars: ✭ 948 (+591.97%)
Mutual labels:  ai, genetic-algorithm
Basic reinforcement learning
An introductory series to Reinforcement Learning (RL) with comprehensive step-by-step tutorials.
Stars: ✭ 826 (+502.92%)
Mutual labels:  ai, reinforcement-learning
Gbrain
GPU Javascript Library for Machine Learning
Stars: ✭ 48 (-64.96%)
Mutual labels:  ai, reinforcement-learning
Pysc2 Examples
StarCraft II - pysc2 Deep Reinforcement Learning Examples
Stars: ✭ 722 (+427.01%)
Mutual labels:  ai, reinforcement-learning
Awesome Artificial Intelligence
A curated list of Artificial Intelligence (AI) courses, books, video lectures and papers.
Stars: ✭ 6,516 (+4656.2%)
Mutual labels:  ai, reinforcement-learning
Rl Course Experiments
Stars: ✭ 73 (-46.72%)
Mutual labels:  reinforcement-learning, genetic-algorithm
Deep Neuroevolution
Deep Neuroevolution
Stars: ✭ 1,526 (+1013.87%)
Mutual labels:  ai, reinforcement-learning

AI plays snake game

Neural Network Trained using Genetic Algorithm which acts as the brain for the snake.

The snake looks in the 8 direction for food, body part and the boundary which acts as the 24 input for the Neural Network.

Getting Started

Prerequisites

To install the dependencies, run on terminal :

python3 -m pip install -r requirements.txt

Project Structure

├── Arena.py            # class that helps in setting the boundary and parameters of the arena
├── brain.py            # class that deals with the neural network
├── colors.py           # consists of colors used in the whole project
├── game.py             # lets the saved snakes to run in 
├── samples
│   ├── generation23.gif    
│   └── generation6.gif
├── input.py            # parametes to apply genetic algorithm on your own
├── README.md
├── requirements.txt    # python dependencies required
├── saved
│   └── top_snakes.pickle   # saved list of objects of snake class for each generation
└── snake.py            # class snake that handles all properties of snake

Training

To train the neural network using Genetic Algorithm, alter the parameters according to your needs inside the input.py, then run the following command specifying the path to save the optimised result as a pickle file (a list is stored, containing the best snake from each generation):

python3 Genetic_algo.py --output saved/test.pickle 

Playing

To run or test the snakes saved previously, run the following commands specifying the path to the saved file :

python3 game.py --input saved/test.pickle

Skipping steps

To skip steps, simply add the -s or --steps argument to the call

python3 game.py --input saved/test.pickle --steps 50

Acknowledgement

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].