MCPcopy Index your code
hub / github.com/MathisWellmann/gym-rs

github.com/MathisWellmann/gym-rs @0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.3.0 ↗ · + Follow
87 symbols 142 edges 21 files 26 documented · 30%
What it actually does AI analysis from the code graph — generated when you open this
loading…
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.

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.

On Ubuntu you can install the dependency as such:

sudo apt-get install libsdl2-dev

On Arch:

sudo pacman -S sdl2 sdl2_gfx

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

nix-shell

Usage

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

[dependencies]
gym_rs = "0.3.0"

Examples

cargo run --example=cartpole

cart_pole

cargo run --example=mountain_car

mountain_car

Contributions

Contributions are welcome. For the contribution guidelines, please take a look at CONTRIBUTING.md.

Donations

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

Monero:

47xMvxNKsCKMt2owkDuN1Bci2KMiqGrAFCQFSLijWLs49ua67222Wu3LZryyopDVPYgYmAnYkSZSz9ZW2buaDwdyKTWGwwb

monero

Extension points exported contracts — how you extend this code

Env (Interface)
Defines a common set of operations available to different environments. [2 implementers]
src/core.rs
Sample (Interface)
Defines a set of operations to sample an observation for an environment. [2 implementers]
src/utils/custom/traits.rs
Space (Interface)
An interface that deals with subspaces. [1 implementers]
src/spaces/space.rs
EnvProperties (Interface)
Defines a set of properties that should be accessible in all environments. [2 implementers]
src/core.rs

Core symbols most depended-on inside this repo

rand_random
called by 5
src/utils/seeding.rs
clip
called by 5
src/utils/custom/util_fns.rs
contains
called by 5
src/spaces/discrete.rs
render_step
called by 3
src/utils/renderer.rs
reset
called by 3
src/utils/renderer.rs
total_mass
called by 3
src/envs/classical_control/cartpole.rs
step
called by 3
src/envs/classical_control/cartpole.rs
get_renders
called by 2
src/utils/renderer.rs

Shape

Method 53
Class 16
Function 10
Enum 4
Interface 4

Languages

Rust100%

Modules by API surface

src/envs/classical_control/cartpole.rs21 symbols
src/envs/classical_control/mountain_car.rs19 symbols
src/utils/custom/screen.rs14 symbols
src/utils/renderer.rs10 symbols
src/core.rs7 symbols
src/utils/custom/util_fns.rs4 symbols
src/spaces/discrete.rs4 symbols
src/utils/seeding.rs2 symbols
src/utils/custom/traits.rs1 symbols
src/utils/custom/structs.rs1 symbols
src/spaces/space.rs1 symbols
src/spaces/box_r.rs1 symbols

For agents

$ claude mcp add gym-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact