Table of Contents

Class CarRacingInfo

Namespace
Gym.Environments.Envs.Box2D
Assembly
Gym.Environments.dll

CarRacing's info (CarRacingEnv, CarRacing-v3), typed (DR-91, DR-95): {} on every reset and on most steps, and {"lap_finished": ...} on the step that ends an episode by finishing the lap or leaving the playfield. LunarLander and BipedalWalker send {} and have no record.

public sealed record CarRacingInfo : EnvInfo, IEquatable<EnvInfo>, IEquatable<CarRacingInfo>
Inheritance
CarRacingInfo
Implements
Inherited Members
Extension Methods

Constructors

CarRacingInfo(bool?)

CarRacing's info (CarRacingEnv, CarRacing-v3), typed (DR-91, DR-95): {} on every reset and on most steps, and {"lap_finished": ...} on the step that ends an episode by finishing the lap or leaving the playfield. LunarLander and BipedalWalker send {} and have no record.

public CarRacingInfo(bool? LapFinished)

Parameters

LapFinished bool?

Whether the episode ended with the lap done (lap_finished): true once every tile was visited, false when the car left the playfield; null on any other step and at reset, where the key is absent.

Properties

LapFinished

Whether the episode ended with the lap done (lap_finished): true once every tile was visited, false when the car left the playfield; null on any other step and at reset, where the key is absent.

public bool? LapFinished { get; init; }

Property Value

bool?

Methods

Equals(CarRacingInfo?)

Record equality (DR-92): the members compare as Python's == compares them (PyEquality), arrays by value; the dict inside takes no part.

public bool Equals(CarRacingInfo? other)

Parameters

other CarRacingInfo

The other record.

Returns

bool

true when the members are equal.

GetHashCode()

A hash consistent with Equals(object): the member count, as array members have no value hash.

public override int GetHashCode()

Returns

int

The hash.

ToInfoCore()

The members as a new dict by Python name, in declaration order, a null member's key left out.

protected override Info ToInfoCore()

Returns

Info

A new dict.

ToString()

Python's repr of the info dict (ToInfo()): {'x_position': np.float64(0.1), ...}.

public override string ToString()

Returns

string

The text.

Operators

implicit operator Info(CarRacingInfo)

The record as an info dict (EnvInfo.ToInfo): the dict it was read from, the env's values kept, else its members by Python name.

public static implicit operator Info(CarRacingInfo value)

Parameters

value CarRacingInfo

The record.

Returns

Info

A new dict; array values are shared, not copied.

Exceptions

ArgumentNullException

Thrown when value is null.

implicit operator CarRacingInfo(Info)

The typed record of an env's info dict (DR-91): each member read with InfoExtensions.Get<T>'s conversions, a nullable member null when its key is absent; the record keeps the dict, whose values its indexer reads.

public static implicit operator CarRacingInfo(Info value)

Parameters

value Info

The info dict, typically step.Info; the record shares it.

Returns

CarRacingInfo

The record.

Exceptions

ArgumentNullException

Thrown when value is null.

KeyError

Thrown, with Python's message, when the key of a member that is not nullable is missing.

InvalidCastException

Thrown when a value cannot be read as its member's type.

OverflowException

Thrown when an integer does not fit its member's type.