Skip to content

Seyronh/gymrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GymRL

npm Author

GymRL is a package that provides various environments for reinforcement learning.

Prerequisites

Before you begin, ensure you have met the following requirements:

Installation

Install GymRL using npm:

$ npm install gymrl --save

Environments

GymRL currently supports the following environments:

  1. TwoThousandfortyeight
  2. Fourinarow
  3. Frozenlake
  4. Snake
  5. TicTacToe
  6. Rubik
  7. Pong

You can import an environment as follows:

const {Snake} = require("gymrl")
const {TwoThousandfortyeight} = require("gymrl")

Usage

Here is an example of how to use the Snake environment:

const {Snake} = require("gymrl")

let match = new Snake(10); // This creates a map of 10x10
let score = 0;
let done = false;

match.render();

let status = match.get_obs();

while(!done){
    let randomAction = Snake.sampleAction();
    let Stepinfo = match.step(randomAction);
    status = Stepinfo[0];
    let reward = Stepinfo[1];
    done = Stepinfo[2];
    let info = Stepinfo[3];
    score += reward;
    match.render();
}

Methods

The following methods are available in all environments:

  • render(): Creates a string representation of the environment and displays it in the console.
  • sampleAction(): Returns a random action from the environment.
  • get_obs(): Returns the current observations of the environment.
  • get_info(): Returns additional information about the observations of the environment.
  • reset(): Resets the environment.
  • step(action): Performs one step in the environment using the specified action and returns an array with four entries: [newStatus, Reward, Done, Info].

More Info About the Environments

You can see more info about the enviroments in our wiki

Contributing to GymRL

If you want to contribute to GymRL, whether by adding a new environment or fixing bugs, please check out the source code and submit a pull request or issue.

About

Reinforcement Learning Enviroments for Javascript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published