Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/MathisWellmann/gym-rs

OpenAI's Gym written in pure Rust for blazingly fast performance
https://github.com/MathisWellmann/gym-rs

ai ml openai-gym reinforcement-learning rl

Last synced: 11 days ago
JSON representation

OpenAI's Gym written in pure Rust for blazingly fast performance

Awesome Lists containing this project

README

        

# OpenAI Gym (Unofficial Rust Implementation)

This library aims be be close to the original OpenAI Gym library written in Python.

If you don't mind Python and would like to use the original implementation from Rust,
check out a [OpenAI Gym wrapper](https://github.com/MrRobb/gym-rs).

## Prerequisites
This library use's SDL2 to enable various forms of rendering. Even when an SDL2
window is not explictly shown, renders can be saved to files making it a mandatory
dependency if any form of rendering is to be done.

- [SDL2](https://wiki.libsdl.org/Installation)
- [SDL2_gfx](https://www.ferzkopp.net/Software/SDL2_gfx/Docs/html/index.html)

On Ubuntu you can install the dependency as such:
```shell
sudo apt install libsdl2-dev
sudo apt install libsdl2-gfx-dev
```

On Arch:
```shell
sudo pacman -S sdl2 sdl2_gfx
```

If your using nix, you can get into the reproducible build environment as simple as:
```shell
nix develop
```

## Usage
To use this crate in your project, put this in your Cargo.toml:

```toml
[dependencies]
gym_rs = "0.3.0"
```

## Usage on Windows:
As per [#6](https://github.com/MathisWellmann/gym-rs/issues/6), here are some instructions for the windows folks:

0. clone the repo & cd to the root dir of the repo
1. modify Cargo.toml, remove dependency sdl2 line and add following code:

```
[dependencies.sdl2]
version = "0.35.2"
default-features = false
features = ["static-link", "use-vcpkg", "gfx"]

[package.metadata.vcpkg]
dependencies = ["sdl2", "sdl2-gfx"]
git = "https://github.com/microsoft/vcpkg"
rev = "16ee2ec"

[package.metadata.vcpkg.target]
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }

```
2. install cargo-vcpkg using cargo install cargo-vcpkg
3. under the root dir of the repo, cargo vcpkg build
4. now build and run, such as cargo run --example=mountain_car

## Examples

```bash
cargo run --example=cartpole
```
![cart_pole](assets/cartpole.png)

```bash
cargo run --example=mountain_car
```
![mountain_car](assets/mountain_car.png)

## Contributions

Contributions are welcome. For the contribution guidelines, please take a look at [CONTRIBUTING.md](./CONTRIBUTING.md).

## Donations

If you would like to support the development of this crate, feel free to send over a donation:

Monero:

```plain
47xMvxNKsCKMt2owkDuN1Bci2KMiqGrAFCQFSLijWLs49ua67222Wu3LZryyopDVPYgYmAnYkSZSz9ZW2buaDwdyKTWGwwb
```

![monero](assets/monero_donations_qrcode.png)