Giter VIP home page Giter VIP logo

deepqlearning-snake-game's Introduction

DeepQLearning-Snake-Game

This is our first approach to reinforced learning algorithms. it's a simple pygame snake-like game, able to train and play at a decent learning rate.

This project was made using

  • Pygame to make the main stages and the snake game itself.
  • Pytorch to make the main learing model.
  • Pandas and numpy to make the main aritmetic operations.
  • Anaconda to make a virtual enviroment suitable for this project

How to install

First you need to install Anaconda virutal enviroment and initialize it by using

conda create -n "Enviroment name" python="version"

Activate virtual enviroment by using.

conda activate "Enviroment name"

Install pygame and pythorch using

pip install pygame
pip install torch torchvision

Install mplotlib and ipython

pip install matplotlib ipython

Finally navigate to root directory and run

python .\agent.py

Omit "" when entering enviroment name and python version

Stages

This project counts with 2 differentes stages. Both are practically the same with a single main difference. Its size.

The first stage its a canvas of 640 by 480 pixels.

The second stage its a canvas of 840 by 680 pixels.

Both stages count with the same agents. We have the main agent, the sanke or player, and food for the snake to grow.

The user is able to change form stage to stage by changing only 1 single line of code. Located at line 30 of game.py file.

  def __init__(self, w=640, h=480):

Just change the with and height to the desired value.

Be advised that we only tested canvas sizes of 640x480 and 840x680 pixels

deepqlearning-snake-game's People

Contributors

whaibe avatar

Watchers

 avatar

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.