From 0730afcb1c27b73f2e5fc832dc1e0c06aba2f2a8 Mon Sep 17 00:00:00 2001 From: rene Date: Sun, 29 Mar 2026 10:37:59 +0200 Subject: [PATCH] Fix: Screen-Clear vor jedem Frame, mehr Fische MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - canvas.render() startet jetzt mit \033[2J um das gesamte Terminal zu löschen, nicht nur die Canvas-Breite (verhindert Trails bei breiten Terminals) - add_all_fish(): min 8 Fische statt 1, dichtere Formel (//200 statt //350) --- asciiquarium_ng.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/asciiquarium_ng.py b/asciiquarium_ng.py index 6082e78..0797c0b 100755 --- a/asciiquarium_ng.py +++ b/asciiquarium_ng.py @@ -119,7 +119,10 @@ class Canvas: self._ck[row][col] = ck def render(self) -> str: - parts = ["\033[H", RESET] + # \033[2J clears the entire terminal (not just our canvas width), + # preventing stale characters when the terminal is wider than self.cols + # or after a resize. The full-canvas overwrite below keeps flicker minimal. + parts = ["\033[2J\033[H", RESET] sentinel = object() last_ck: object = sentinel for r in range(self.rows): @@ -461,7 +464,7 @@ class Aquarium: # ── Fish ───────────────────────────────────────────────────────────────── def add_all_fish(self): - count = max(1, (self.rows - 9) * self.cols // 350) + count = max(8, (self.rows - 9) * self.cols // 200) for _ in range(count): self.add_fish(None)