Fix: Screen-Clear vor jedem Frame, mehr Fische
- 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)
This commit is contained in:
parent
1f053822ff
commit
0730afcb1c
1 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue