How to use the textworld.generator.compile_game function in textworld

To help you get started, we’ve selected a few textworld examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xingdi-eric-yuan / TextWorld-Coin-Collector / gym_textworld / gym_textworld / envs / coin_collector.py View on Github external
def _make_game(self, seeds):
        options = GameOptions()
        options.seeds = seeds
        options.grammar = GrammarOptions(self.grammar_flags)
        game = make_game_from_level(self.level, options)
        hashid = encode_seeds([self.game_generator_seed, self.level] + [seeds[k] for k in sorted(seeds)])
        game_name = "{}_{}".format(self.spec.id, hashid)
        game_file = textworld.generator.compile_game(game, path=pjoin("gen_games", str(self.spec.id), game_name + ".ulx"))
        return game_file
github microsoft / TextWorld / textworld / helpers.py View on Github external
def make(options: GameOptions) -> Tuple[str, Game]:
    """ Makes a text-based game.

    Arguments:
        options:
            For customizing the game generation (see
            :py:class:`textworld.GameOptions `
            for the list of available options).

    Returns:
        A tuple containing the path to the game file, and its corresponding Game's object.
    """
    game = make_game(options)
    game_file = compile_game(game, options)
    return game_file, game