def __init__(self, *args, **kwargs): kwargs["max_episode_steps"] = kwargs.pop("max_episode_steps", 350) n_monster = kwargs.pop("n_monster", 0) n_boulder = kwargs.pop("n_boulder", 5) narrow = kwargs.pop("narrow", False) lava = kwargs.pop("lava", False) if narrow: map = """ ..................WW..... ..................WW..... ..................WW..... ..................WW..... ..................WW..... ..................WW..... ..................WW..... """ elif not lava: map = """ ..................WWW.... ..................WWW.... ..................WWW.... ..................WWW.... ..................WWW.... ..................WWW.... ..................WWW.... """ else: map = """ ..................LLL.... ..................LLL.... ..................WWW.... ..................LLL.... ..................WWW.... ..................LLL.... ..................LLL.... """ lvl_gen = LevelGenerator(map=map) lvl_gen.set_start_rect((0, 0), (18, 6)) for _ in range(n_monster): lvl_gen.add_monster() lvl_gen.set_area_variable( "$boulder_area", type="fillrect", x1=1, y1=1, x2=18, y2=5 ) for _ in range(n_boulder): lvl_gen.add_object_area("$boulder_area", name="boulder", symbol="`") lvl_gen.add_goal_pos((25, 2)) super().__init__(*args, des_file=lvl_gen.get_des(), **kwargs)
def __init__(self, *args, lit=True, **kwargs): kwargs["character"] = "kni-hum-law-fem" # tested on human knight kwargs["max_episode_steps"] = kwargs.pop("max_episode_steps", 350) map = """ ----- ---------------------- |...| |....................| |....#######.....................| |...| |....................| ----- ---------------------- """ lvl_gen = LevelGenerator(map=map, lit=lit) lvl_gen.set_start_rect((1, 1), (3, 3)) lvl_gen.add_monster(name="giant rat", place=(30, 1)) lvl_gen.add_monster(name="giant rat", place=(30, 2)) lvl_gen.add_monster(name="giant rat", place=(30, 3)) lvl_gen.add_monster(name="giant rat", place=(31, 1)) lvl_gen.add_monster(name="giant rat", place=(31, 2)) lvl_gen.add_monster(name="giant rat", place=(31, 3)) lvl_gen.add_goal_pos((32, 2)) super().__init__(*args, des_file=lvl_gen.get_des(), **kwargs)
def __init__(self, *args, **kwargs): map = """ |---------------------------| |...........................| |.....|---------------------| |.....| |.....| |-----| """ lvl_gen = LevelGenerator(map=map, lit=True) lvl_gen.set_start_rect((1, 1), (5, 5)) lvl_gen.add_goal_pos((27, 1)) lvl_gen.set_area_variable("$safe_room", "fillrect", 1, 1, 5, 5) lvl_gen.add_object_area("$safe_room", name="death", symbol="/", cursestate="blessed") lvl_gen.add_monster("minotaur", place=(26, 1)) des_file = lvl_gen.get_des() kwargs["max_episode_steps"] = kwargs.pop("max_episode_steps", 400) super().__init__(*args, des_file=des_file, **kwargs)