from shutil import get_terminal_size as getTerminalSize # ░█▀▄░█▀█░█▀█░█▀▄░█▀█░█▄█░░░█▀▀░█░█░▀█▀░▀█▀ # ░█▀▄░█▀█░█░█░█░█░█░█░█░█░░░▀▀█░█▀█░░█░░░█░ # ░▀░▀░▀░▀░▀░▀░▀▀░░▀▀▀░▀░▀░░░▀▀▀░▀░▀░▀▀▀░░▀░ def centerText(text): terminalWidth = getTerminalSize((60, 0))[0] # Column size 60 as fallback return "\n".join(line.center(terminalWidth) for line in text.split('\n')) def centerBlockText(text): terminalWidth = getTerminalSize((60, 0))[0] # Column size 60 as fallback textArray = text.split('\n') offset = int((terminalWidth - len(textArray[0])) / 2) return "\n".join(offset * ' ' + line for line in textArray) boxCharsToBoldBoxCharsMap = { '─': '═', '│': '║', '┼': '╬', '╰': '╚', '╯': '╝', '╭': '╔', '╮': '╗', '├': '╠', '┴': '╩', '┤': '╣', '┬': '╦', } def determineMove(key, x, y, maxmin) -> tuple: if key in ['s', 'j'] and y != maxmin[1]: return (0, 1) elif key in ['w', 'k'] and y != maxmin[0]: return (0, -1) elif key in ['d', 'l'] and x != maxmin[1]: return (1, 0) elif key in ['a', 'h'] and x != maxmin[0]: return (-1, 0) else: return False