catanatron.gym package#
Subpackages#
Submodules#
catanatron.gym.board_tensor_features module#
- catanatron.gym.board_tensor_features.create_board_tensor(game: Game, p0_color: Color, channels_first=False)#
Creates a tensor of shape (WIDTH=21, HEIGHT=11, CHANNELS).
1 x n hot-encoded planes (2 and 1s for city/settlements). 1 x n planes for the roads built by each player. 5 tile resources planes, one per resource. 1 robber plane (to note nodes blocked by robber). 6 port planes (one for each resource and one for the 3:1 ports)
Example
To see WHEAT plane: tf.transpose(board_tensor[:,:,3])
- catanatron.gym.board_tensor_features.get_channels(num_players)#
- catanatron.gym.board_tensor_features.get_node_and_edge_maps()#
- catanatron.gym.board_tensor_features.get_numeric_features(num_players)#
- catanatron.gym.board_tensor_features.get_tile_coordinate_map()#
- catanatron.gym.board_tensor_features.init_board_tensor_map()#
- catanatron.gym.board_tensor_features.init_tile_coordinate_map()#
Creates a tile (x,y,z) => i,j mapping, where i,j is top-left of 3x6 matrix and respect (WIDTH, HEIGHT) ordering
- catanatron.gym.board_tensor_features.is_graph_feature(feature_name)#