コード例 #1
0
    def __init__(self, *args, **kwargs):
        map = """
|----------
|.........+
|----------
"""
        lvl_gen = LevelGenerator(map=map, lit=True)

        lvl_gen.set_start_pos((1, 1))
        kwargs["options"] = kwargs.pop("options", [])
        kwargs["options"].append("autopickup")
        kwargs["max_episode_steps"] = kwargs.pop("max_episode_steps", 50)

        lvl_gen.add_object(name="death",
                           symbol="/",
                           cursestate="blessed",
                           place=((1, 1)))
        lvl_gen.add_monster("minotaur", args=("asleep", ), place=(9, 1))

        des_file = lvl_gen.get_des()

        rwrd_mngr = RewardManager()
        rwrd_mngr.add_kill_event("minotaur")

        super().__init__(*args,
                         des_file=des_file,
                         reward_manager=rwrd_mngr,
                         **kwargs)
コード例 #2
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_object("levitation",
                           "!",
                           place=(0, 0),
                           cursestate="blessed")
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        super().__init__(*args, des_file=des_file, **kwargs)
コード例 #3
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_object("dagger", ")", place=(0, 0))
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        reward_manager = RewardManager()
        reward_manager.add_wield_event("dagger")

        super().__init__(
            *args, des_file=des_file, reward_manager=reward_manager, **kwargs
        )
コード例 #4
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_sink(place=(0, 0))
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        reward_manager = RewardManager()
        reward_manager.add_positional_event("sink", "quaff")

        super().__init__(
            *args, des_file=des_file, reward_manager=reward_manager, **kwargs
        )
コード例 #5
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_altar((0, 0), "neutral", "altar")
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        reward_manager = RewardManager()
        reward_manager.add_positional_event("altar", "pray")

        super().__init__(
            *args, des_file=des_file, reward_manager=reward_manager, **kwargs
        )
コード例 #6
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_object("blank paper", "?", place=(0, 0))
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        reward_manager = RewardManager()
        reward_manager.add_message_event(["This scroll seems to be blank."])

        super().__init__(
            *args, des_file=des_file, reward_manager=reward_manager, **kwargs
        )
コード例 #7
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_object("enlightenment", "/", place=(0, 0))
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        reward_manager = RewardManager()
        reward_manager.add_message_event(["The feeling subsides."])  # TODO change

        super().__init__(
            *args, des_file=des_file, reward_manager=reward_manager, **kwargs
        )
コード例 #8
0
    def __init__(self, *args, **kwargs):
        lvl_gen = LevelGenerator(w=5, h=5, lit=True)
        lvl_gen.add_object("amulet of life saving", '"', place=(0, 0))
        lvl_gen.set_start_pos((2, 2))
        des_file = lvl_gen.get_des()

        reward_manager = RewardManager()
        reward_manager.add_amulet_event()

        super().__init__(
            *args, des_file=des_file, reward_manager=reward_manager, **kwargs
        )
コード例 #9
0
    def __init__(self, *args, **kwargs):
        map = """
|---------------------------|
|...........................|
|---------------------------|
"""
        lvl_gen = LevelGenerator(map=map, lit=True)

        lvl_gen.set_start_pos((1, 1))
        lvl_gen.add_goal_pos((27, 1))

        lvl_gen.add_object(name="death",
                           symbol="/",
                           cursestate="blessed",
                           place=((2, 1)))
        lvl_gen.add_monster("minotaur", args=("asleep", ), place=(26, 1))
        kwargs["max_episode_steps"] = kwargs.pop("max_episode_steps", 150)

        des_file = lvl_gen.get_des()
        super().__init__(*args, des_file=des_file, **kwargs)