(stars: list[list[int]])
| 2 | import re |
| 3 | |
| 4 | def print_grid(stars: list[list[int]]) -> str | None: |
| 5 | ymin, ymax = min(s[1] for s in stars), max(s[1] for s in stars) |
| 6 | if ymax-ymin > 10: |
| 7 | return None |
| 8 | xmin, xmax = min(s[0] for s in stars), max(s[0] for s in stars) |
| 9 | grid = '\n' |
| 10 | for y in range(ymin,ymax+1): |
| 11 | grid += '\n' |
| 12 | for x in range(xmin,xmax+1): |
| 13 | grid += '█' if any(s[0]==x and s[1]==y for s in stars) else ' ' |
| 14 | return grid |
| 15 | |
| 16 | @aoc.main('10') |
| 17 | def main(indata: str) -> tuple[str,int]: |