Code Monkey home page Code Monkey logo

gym-maze's Introduction

gym-maze

A simple 2D maze environment where an agent (blue dot) finds its way from the top left corner (blue square) to the goal at the bottom right corner (red square). The objective is to find the shortest path from the start to the goal.

Simple 2D maze environment

Action space

The agent may only choose to go up, down, right, or left ("N", "S", "E", "W"). If the way is blocked, it will remain at the same the location.

Observation space

The observation space is the (x, y) coordinate of the agent. The top left cell is (0, 0).

Reward

A reward of 1 is given when the agent reaches the goal. For every step in the maze, the agent recieves a reward of -0.1/(number of cells).

End condition

The maze is reset when the agent reaches the goal.

Maze Versions

Pre-generated mazes

  • 3 cells x 3 cells: MazeEnvSample3x3
  • 5 cells x 5 cells: MazeEnvSample5x5
  • 10 cells x 10 cells: MazeEnvSample10x10
  • 100 cells x 100 cells: MazeEnvSample100x100

Randomly generated mazes (same maze every epoch)

  • 3 cells x 3 cells: MazeEnvRandom3x3
  • 5 cells x 5 cells: MazeEnvRandom5x5
  • 10 cells x 10 cells: MazeEnvRandom10x10
  • 100 cells x 100 cells: MazeEnvRandom100x100

Randomly generated mazes with portals and loops

With loops, it means that there will be more than one possible path. The agent can also teleport from a portal to another portal of the same colour.

  • 10 cells x 10 cells: MazeEnvRandom10x10Plus
  • 20 cells x 20 cells: MazeEnvRandom20x20Plus
  • 30 cells x 30 cells: MazeEnvRandom30x30Plus

Installation

It should work on both Python 2.7+ and 3.4+. It requires pygame and numpy.

cd gym-maze
python setup.py install

Examples

An example of finding the shortest path through the maze using Q-learning can be found here: https://github.com/tuzzer/ai-gym/blob/master/maze_2d/maze_2d_q_learning.py

Solving 20x20 maze with loops and portals using Q-Learning

gym-maze's People

Contributors

dylancope avatar mattchantk avatar rafaie avatar kuzat avatar l45k 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.