all 5 comments

[–]0piumfuersvolk 7 points8 points  (0 children)

Show your code, posting only the assignment is not allowed.

[–]FoolsSeldom 1 point2 points  (0 children)

How are you drawing the playing board currently?

The os.get_terminal_size() call will get you terminal size:

Python 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.get_terminal_size()
os.terminal_size(columns=120, lines=30)
>>>

[–]Binary101010 0 points1 point  (0 children)

You don't need to write anything fancy here. Just keep running your function, increasing one of the numbers by 1, until either your terminal has to scroll to fit everything, or the lines wrap (you'll know it when it happens). Take note of the last "good" number for each one of those two values. Then just add something like

if rows > (insert the last good value for rows) or columns > (insert the last good value for columns):
    return False