Giter Site home page Giter Site logo

drl4snakegame's Introduction

DRL4SnakeGame

Using deep reinforcement learning to play Snake game(贪吃蛇).

The used algorithm is PPO for discrete! It has the brilliant performance in the field of discrete action space just like in continuous action space.

You just need half an hour to train the snake and then it can be as smart as you.

Result

Figure_1result

Figure_1result

File to Illustrate

Agent.py: file to store the algorithm.

core.py: file to store the net for DRL algorithm.

draw.py: file to draw the reward curve.

env4Snake.py: the environment for snake game.

main.py: the main func.

what you need to do is to run the main.py and then run the env4Snake to test your mdoel!

Requirements

  1. torch
  2. numpy
  3. seaborn==0.11.1
  4. pygame==2.0.1
  5. matplotlib==3.2.2
  6. PIL(This is unimportant. I do not use this package in running process.)

Details for realization

See my blog for details: https://blog.csdn.net/weixin_43145941/article/details/118639211

drl4snakegame's People

Contributors

zyunfeii 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.