def add_monster()

in minihack/level_generator.py [0:0]


    def add_monster(self, name="random", symbol=None, place=None, args=()):
        """Add a monster to the map.

        Args:
            name (str):
                The name of the monster. Defaults to random.
            symbol (str or None):
                The symbol of the monster. The symbol should correspond to the
                family of the specified mosnter. For example, "d" symbol
                corresponds to canine monsters, so the name of the object should
                also correspond to canines  (e.g. jackal). Not used when name is
                "random". Defaults to None.
            place (None, tuple or str):
                The place of the added object. If None, the location is
                selected randomly. Tuple values are used for providing exact
                (x, y) coordinates. String values are copied to des-file as is.
                Defaults to None.
            args (tuple):
                Additional monster arguments, e.g. "hostile" or "peaceful",
                "asleep" or "awake", etc. For more details, see
                https://nethackwiki.com/wiki/Des-file_format#MONSTER.
        """
        place = self._validate_place(place)
        assert (
            symbol == "random"
            or symbol is None
            or (isinstance(symbol, str) and len(symbol) == 1)
        )
        assert isinstance(
            name, str
        )  # TODO maybe check object exists in NetHac

        if name != "random":
            name = f'"{name}"'

        if symbol is not None:
            name = f"('{symbol}',{name})"

        self.footer += f"MONSTER:{name},{place}"

        if len(args) > 0:
            assert any(
                arg in ["hostile", "peaceful", "asleep", "awake"]
                for arg in args
            )
            for arg in args:
                self.footer += f",{arg}"

        self.footer += "\n"