Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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