Giter Site home page Giter Site logo

malolm / advanced-star-collector Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.69 MB

A multicore client-server for training a DQN agent on an advanced version of the star collector game

Python 100.00%
machine-learning pygame python reinforcement-learning tensorflow python-flask python-multithreading

advanced-star-collector's Introduction

Star Collector Reinforcement Learning Project

demo

What's This Project All About?

I've been working on this project to level up my skills in reinforcement learning and machine learning in general. The main goal was to teach a DQN (Deep Q-Network) agent to play "Star Collector." It was a fun and challenging journey, and I learned a ton along the way.

About Star Collector

The Rules of the Game

"Star Collector" is pretty straightforward: you've got this agent whose mission is to grab as many stars as possible and finally take the green exit door.

Why It's Tougher Than It Looks in this implementation

  • The agent can only see what's directly around it, not the whole board. So, it's like playing blindfolded and having to make the best move.
  • Time? The agent doesn't know either. It just knows what's happening right now and how many stars it has.
  • No two games are the same because the stars get placed randomly every time. This keeps the agent on its toes.

Why I Did This

To be honest, this project is more for kicks and learning than anything else. It was a great way to get hands-on experience with reinforcement learning, but I'm not planning to turn it into something big.

Evaluation of Results

Given the complexity of the problem, especially considering the limited state information available to the DQN agent for learning, the results obtained are highly satisfactory, albeit imperfect. Please refer to the examples provided above for a more detailed understanding of the agent's performance.

Getting Started

If you're curious and want to mess around with it yourself, here's how to get the ball rolling:

What You Need

Check out the requirements.txt file—it's got all the packages you need to run the clients and the server.

Setting Things Up

First off, install all the dependencies:

pip install -r requirements.txt

Running the Show

Make sure you start the server before the clients. You need to restart the server for each new training round (kinda annoying, I know).

Server Side:

Get the Flask server up with:

flask --app main run --debug --no-reload

Client Time:

Head over to the ./client directory and run:

python main.py

TensorBoard for the Wins:

To see how your training's doing, launch TensorBoard from the ./flask-server directory:

tensorboard --logdir=./tensorflow/

And that's pretty much it! Dive in, play around, and see how you can make the agent smarter at collecting stars.

Model Testing and Output

Currently, the process of model testing involves saving game sessions as GIF files in the /tmp/ directory of the user's system. It is imperative to retrieve these files prior to any system reset by Linux/macOS, as such resets will result in the deletion of the data stored in this temporary directory.

advanced-star-collector's People

Contributors

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