diff --git a/tngame/utils.py b/tngame/utils.py index 9ac4f0e..86185d8 100644 --- a/tngame/utils.py +++ b/tngame/utils.py @@ -21,3 +21,10 @@ def setup_logger(debug: bool): ) return logging.getLogger("a2") + + +def get_ascii_dimensions(ascii_art: str) -> tuple[int, int]: + """Get the dimensions of an ASCII art.""" + height = ascii_art.count('\n') + width = max(len(line.strip('\n')) for line in ascii_art.splitlines()) + return height, width