catanatron_gym package

Submodules

catanatron_gym.features module

catanatron_gym.features.build_production_features(consider_robber)
catanatron_gym.features.count_production(nodes, catan_map)
catanatron_gym.features.create_sample(game, p0_color)
catanatron_gym.features.create_sample_vector(game, p0_color, features=None)
catanatron_gym.features.expansion_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)
catanatron_gym.features.game_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)
catanatron_gym.features.get_feature_ordering(num_players=4, map_type: Literal[BASE, MINI, TOURNAMENT] = 'BASE')
catanatron_gym.features.get_node_hot_encoded(player_index, colors, settlements, cities, roads)
catanatron_gym.features.get_node_production(catan_map, node_id, resource)
catanatron_gym.features.get_owned_or_buildable(game, color, board_buildable)
catanatron_gym.features.get_player_expandable_nodes(game: catanatron.game.Game, color: catanatron.models.player.Color)
catanatron_gym.features.get_zero_nodes(game, color)
catanatron_gym.features.graph_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)
catanatron_gym.features.initialize_graph_features_template(num_players, catan_map: catanatron.models.map.CatanMap)
catanatron_gym.features.is_building(game, node_id, color, building_type)
catanatron_gym.features.is_road(game, edge, color)
catanatron_gym.features.iter_level_nodes(enemy_nodes, enemy_roads, num_roads, zero_nodes)

Iterates over possible expansion paths.

Parameters
  • enemy_nodes (frozenset[NodeId]) – node_ids owned by enemy colors

  • enemy_roads (frozenset[EdgeId]) – edge_ids owned by enemy colors

  • num_roads (int) – Max-depth of BFS (inclusive). e.g. 2 will yield possible expansions with up to 2 roads.

  • zero_nodes (frozenset[NodeId]) – Nodes reachable per board.connected_components

Yields

Tuple[int, Set[NodeId], Dict[NodeId, List[EdgeId]] – First element is level (roads needed to get there). Second element is set of node_ids reachable at this level. Third is mapping of NodeId to the list of edges

that leads to shortest path to that NodeId.

catanatron_gym.features.iter_players(colors: Tuple[catanatron.models.player.Color], p0_color: catanatron.models.player.Color)

Iterator: for i, player in iter_players(game, p0.color)

catanatron_gym.features.map_port_features(catan_map)
catanatron_gym.features.map_tile_features(catan_map: catanatron.models.map.CatanMap, robber_coordinate)
catanatron_gym.features.player_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)
catanatron_gym.features.port_distance_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)
catanatron_gym.features.port_features(game, p0_color)
catanatron_gym.features.reachability_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color, levels=2)
catanatron_gym.features.resource_hand_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)
catanatron_gym.features.tile_features(game: catanatron.game.Game, p0_color: catanatron.models.player.Color)

Module contents