Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FrozenLake

An environment implementing the toy text "Frozen Lake" game.

Actions:

  1. Up.
  2. Right.
  3. Down.
  4. Left.

Rewards:

  • 1: If reach target 'G'.
  • 0: Otherwise.
example
import {FrozenLake} from "gym-js";
let mapSize=4,p=0.8,isSlippery=false;
const env = new FrozenLake(mapSize, p, isSlippery);

console.log(env.action_space.toString());
> Discrete: 4    // 4 possible movements
console.log(env.observation_space.toString());
> Discrete: 16   // 4x4 map

let action = env.action_space.sample();
let [obs, rew, done, info] = env.step(action);

Hierarchy

  • FrozenLake

Implements

Index

Constructors

constructor

  • new FrozenLake(mapSize?: number, p?: number, isSlippery?: boolean): FrozenLake
  • Parameters

    • Optional mapSize: number

      The size of the map

    • Optional p: number

      The probability of not slipping

    • Optional isSlippery: boolean

      Set the ice to slippery or not. This makes the agent move in a random direction with probability 1-p.

    Returns FrozenLake

Properties

Private _toObs

_toObs: any

action_space

action_space: Discrete

col

col: number

done

done: boolean

Private inMap

inMap: any

isSlippery

isSlippery: boolean

map

map: string[][]

mapSize

mapSize: number

Private move

move: any

observation_space

observation_space: Discrete

p

p: number

reward_range

reward_range: Space

row

row: number

Methods

close

  • close(): void
  • Returns void

render

  • render(): void
  • Returns void

renderHTML

  • renderHTML(): string
  • Returns string

reset

  • reset(): tf.Tensor
  • Returns tf.Tensor

seed

  • seed(seed: number): void
  • Parameters

    • seed: number

    Returns void

step

  • step(action: number): [tf.Tensor, number, boolean, __type]
  • Parameters

    • action: number

    Returns [tf.Tensor, number, boolean, __type]

Generated using TypeDoc