• Stars
    star
    158
  • Rank 236,298 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AI for Snake game trained from pixels using Deep Reinforcement Learning (DQN).

snake-ai-reinforcement

AI for Snake game trained from pixels using Deep Reinforcement Learning (DQN).

Contains the tools for training and observing the behavior of the agents, either in CLI or GUI mode.

Requirements

All modules require Python 3.6 or above. Note that support for Python 3.7 in TensorFlow is experimental at the time of writing, and requirements may need to be updated as new official versions get released.

Training on GPU is supported but disabled by default. If you have CUDA and would like to use a GPU, use the GPU version of TensorFlow by changing tensorflow to tensorflow-gpu in the requirements file.

To install all Python dependencies, run:

$ make deps

Pre-Trained Models

You can find a few pre-trained DQN agents on the Releases page. Pass the model file to the play.py front-end script (see play.py -h for help).

  • dqn-10x10-blank.model

    An agent pre-trained on a blank 10x10 level (snakeai/levels/10x10-blank.json).

  • dqn-10x10-obstacles.model

    An agent pre-trained on a 10x10 level with obstacles (snakeai/levels/10x10-obstacles.json).

Training a DQN Agent

To train an agent using the default configuration, run:

$ make train

The trained model will be checkpointed during the training and saved as dqn-final.model afterwards.

Run train.py with custom arguments to change the level or the duration of the training (see train.py -h for help).

Playback

The behavior of the agent can be tested either in batch CLI mode where the agent plays a set of episodes and outputs summary statistics, or in GUI mode where you can see each individual step and action.

To test the agent in batch CLI mode, run the following command and check the generated .csv file:

$ make play

To use the GUI mode, run:

$ make play-gui

To play on your own using the arrow keys (I know you want to), run:

$ make play-human

Running Unit Tests

$ make test

More Repositories

1

kaggle-quora-question-pairs

My solution to Kaggle Quora Question Pairs competition (Top 2%, Private LB log loss 0.13497).
Jupyter Notebook
103
star
2

midichlorian

A Visual Studio extension that allows you to write code and automate the IDE using MIDI musical instruments.
C#
69
star
3

dechorder

Automatic chord recognition application powered by machine learning
Python
63
star
4

syno-plex-update

Automatically check for Plex Media Server updates on Synology NAS and install them. Compatible with DSM 6 and DSM 7, including DSM 7.2.2+.
Shell
47
star
5

regex-builder

.NET library for human-readable declaration of regular expressions without having to remember the regex syntax. Looks similar to Expression Trees in .NET.
C#
40
star
6

odsc-target-leakage-workshop

Workshop on Target Leakage in Machine Learning I taught at ODSC Europe 2018 (London) and ODSC East 2019, 2020 (Boston)
Jupyter Notebook
36
star
7

persistent-touch-id-sudo

Configures PAM on macOS via a Launch Daemon so that Touch ID for sudo is always available and persists across OS upgrades
C
28
star
8

unicode-virtual-keyboard

Windows utility that simplifies the input of Unicode characters by displaying a handy on-demand virtual keyboard with powerful character search functionality and global hotkey support.
C#
26
star
9

thrones2vec

Using Word2Vec to explore semantic similarities between the entities of "A Song of Ice and Fire" ("Game of Thrones").
Jupyter Notebook
26
star
10

azure-cloud-ocr

A simple cloud OCR application that employs Windows Azure Web and Worker Roles, Blobs, Tables, Queues, and uses Google Tesseract for text recognition.
JavaScript
17
star
11

cartpole-q-learning

A cart pole balancing agent powered by Q-Learning.
Python
13
star
12

lits-algorithms-course

Notes and handouts from the Algorithms course I taught at Lviv IT School.
TeX
10
star
13

pygoose

A Python package used as a utility tool belt for Kaggle competitions and other Data Science experiments.
Python
6
star
14

dou-topic-modeling

Analyzing the topic structure of DOU.ua comments using Latent Dirichlet Allocation (LDA).
Jupyter Notebook
5
star
15

ansible-role-jupyter

An Ansible role to install and configure Jupyter for Python 3.
5
star
16

pythonscript-namebatch

Generates spells to summon Benedict Cumberbatch.
Python
4
star
17

dunedynasty-macos

A fork of Dune Dynasty (http://dunedynasty.sourceforge.net/) that can be built and run on modern Macs, including Apple Silicon (M1)
C
4
star
18

datarobot-mlbench

Evaluation of the DataRobot platform on the mlbench benchmark [H. Zhang et al., 2017]
Python
4
star
19

ucu-nlp-workshop

Supplementary resources for the NLP Summer Workshop I taught at UCU.
Jupyter Notebook
3
star
20

enex2csv

Convert Evernote ENEX files to CSV, optionally converting note content to Markdown
Python
3
star
21

hammurabi

An online judge for algorithmic contests. Strict, but fair.
Python
3
star
22

intel-8080-asm

A very simple Win32 assembler for Intel 8080 that produces COM binaries for CP/M. I built this during my 2nd university year as a replacement for the tool we had at our lab, which often failed to compile large programs and produced misleading error messages.
C++
3
star
23

gdg-speech-classifier

A machine learning system that recognizes the word 'Google' in human speech (demo for my talk @ Lviv GDG meetup).
MATLAB
2
star
24

ucu-ai-checkers

Checkers game AI development tools for the CS301 AI class I teach at UCU.
Python
2
star
25

winforms-auto-taborder-vsaddin

Visual Studio add-in that adds automatic TabOrder arrangement feature to Windows Forms designer
C#
2
star
26

r-exercises

Programming exercises for R: http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/reed/rexercises.pdf
R
1
star
27

libcheckers

International checkers gameplay library for the CS301 AI course I teach at UCU.
Python
1
star
28

ansible-role-anaconda

An Ansible role to install Anaconda on Linux, along with additional conda packages of your choice.
1
star
29

filesystem-monitor-service

Client-server application (WinForms client + NT Service + MS Access DB) for monitoring changes to a remote file system [university project, 2009]
C#
1
star
30

streamlit-blackout-stats

Streamlit app for visualizing power outage statistics. Uses Google Sheets as the data source.
Python
1
star