Class Connect2

Inheritance Relationships

Base Type

  • public bitrl::envs::EnvBase< TimeStep< std::vector< uint_t > >, DiscreteVectorStateDiscreteActionEnv< 53, 0, 4, uint_t > > (Template Class EnvBase)

Class Documentation

class Connect2 : public bitrl::envs::EnvBase<TimeStep<std::vector<uint_t>>, DiscreteVectorStateDiscreteActionEnv<53, 0, 4, uint_t>>

Implementation of Connect2 environment from https://github.com/JoshVarty/AlphaZeroSimple Initially the environment has all its positions set to zero. When a player makes a move then the position corresponding to this move.

Public Types

typedef EnvBase<TimeStep<std::vector<uint_t>>, DiscreteVectorStateDiscreteActionEnv<53, 0, 4, uint_t>> base_type

The base type.

typedef base_type::time_step_type time_step_type

The type of the time step.

typedef base_type::state_space_type state_space_type

The type describing the state space for the environment.

typedef base_type::action_space_type action_space_type

The type of the action space for the environment.

typedef base_type::action_type action_type

The type of the action to be undertaken in the environment.

typedef base_type::state_type state_type

The state type.

Public Functions

Connect2()

Constructor.

explicit Connect2(uint_t cidx)

Constructor.

Connect2(const Connect2 &other)
virtual void make(const std::string &version, const std::unordered_map<std::string, std::any> &options) final override

make. Builds the environment. Optionally we can choose if the environment will be slippery

virtual time_step_type step(const action_type &action) final override

step. Move in the environment with the given action This function always moves player_1

Parameters:

action

Returns:

inline virtual void close() final override

close

virtual time_step_type reset(uint_t, const std::unordered_map<std::string, std::any>&) final override

Reset the environment.

Connect2 make_copy(uint_t cidx) const

Create a new copy of the environment with the given copy index.

inline uint_t n_states() const noexcept

n_states. Returns the number of states

inline uint_t n_actions() const noexcept

n_actions. Returns the number of actions

time_step_type move(const uint_t pid, const action_type &action)

Make a move for the player with the given id.

bool is_win(uint_t player) const noexcept

Returns true if the player wins.

Returns true if there are still legal moves to do.

std::vector<uint_t> get_valid_moves() const

Get the valid moves.

Public Static Attributes

static const std::string name = "Connect2"

name