def make(environment_name="Hanabi-Full", num_players=2, mcts_player=0, determine_type=0, score_type=0, pyhanabi_path=None): """Make an environment. Args: environment_name: str, Name of the environment to instantiate. num_players: int, Number of players in this game. pyhanabi_path: str, absolute path to header files for c code linkage. Returns: env: An `Environment` object. Raises: ValueError: Unknown environment name. """ if pyhanabi_path is not None: prefixes = (pyhanabi_path, ) assert pyhanabi.try_cdef(prefixes=prefixes), "cdef failed to load" assert pyhanabi.try_load(prefixes=prefixes), "library failed to load" if (environment_name == "Hanabi-Full" or environment_name == "Hanabi-Full-CardKnowledge"): return MCTSEnv( config={ "colors": 5, "ranks": 5, "players": num_players, "mcts_player": mcts_player, "determine_type": determine_type, "score_type": score_type, "max_information_tokens": 8, "max_life_tokens": 3, "observation_type": pyhanabi.AgentObservationType.CARD_KNOWLEDGE.value }) else: raise ValueError("Unknown environment {}".format(environment_name))
def make(environment_name="Hanabi-Full", num_players=2, pyhanabi_path=None): """Make an environment. Args: environment_name: str, Name of the environment to instantiate. num_players: int, Number of players in this game. pyhanabi_path: str, absolute path to header files for c code linkage. Returns: env: An `Environment` object. Raises: ValueError: Unknown environment name. """ if pyhanabi_path is not None: prefixes = (pyhanabi_path, ) assert pyhanabi.try_cdef(prefixes=prefixes), "cdef failed to load" assert pyhanabi.try_load(prefixes=prefixes), "library failed to load" if (environment_name == "Hanabi-Full" or environment_name == "Hanabi-Full-CardKnowledge"): return HanabiEnv( config={ "colors": 5, "ranks": 5, "players": num_players, "max_information_tokens": 8, "max_life_tokens": 3, "observation_type": pyhanabi.AgentObservationType.CARD_KNOWLEDGE.value, 'random_start_player': True }) elif environment_name == "Hanabi-Full-Minimal": return HanabiEnv( config={ "colors": 5, "ranks": 5, "players": num_players, "max_information_tokens": 8, "max_life_tokens": 3, "observation_type": pyhanabi.AgentObservationType.MINIMAL.value }) elif environment_name == "Hanabi-Small": return HanabiEnv( config={ "colors": 2, "ranks": 5, "players": num_players, "hand_size": 2, "max_information_tokens": 3, "max_life_tokens": 1, "observation_type": pyhanabi.AgentObservationType.CARD_KNOWLEDGE.value }) elif environment_name == "Hanabi-Very-Small": return HanabiEnv( config={ "colors": 1, "ranks": 5, "players": num_players, "hand_size": 2, "max_information_tokens": 3, "max_life_tokens": 1, "observation_type": pyhanabi.AgentObservationType.CARD_KNOWLEDGE.value }) else: raise ValueError("Unknown environment {}".format(environment_name))