def get_game(): cfg = Config() cfg.game.fps = 60 cfg.game.x_axis = 1 cfg.game.y_axis = 1 cfg.update() spawn = SpawnSimple(game_config=cfg) spawn.add_location((10, 10)) # Dummy location game = Game( config=cfg, game_id=0, noise=False, overwrite=True, save_path="tests/games_db/", silent=True, spawn_func=spawn, wall_bound=True, ) game.set_player_init_pos(Vec2d(0.5, 0.5)) game.sample_target() game.reset() return game
""" inspect_games.py Check if all games are created correctly. """ import os from config import Config from environment.game import Game if __name__ == '__main__': os.chdir("../..") config = Config() for g_id in [1, 2, 3]: try: game = Game( game_id=g_id, config=config, save_path="environment/games_db/", overwrite=False, silent=True, ) game.close() game.reset() game.get_blueprint() game.get_observation() game.step(0, 0) except Exception: print(f"Bug in game: {g_id}, please manually redo this one")