v1.1: Stufen Easy/Normal/Hard mit Auswahlmenü (Hard = altes Tempo). Koffer behalten beim Drehen ihre Textur. Name/Punkteliste entfernt, nur Stufe + Prozent. Endlos: Ergebnis -> "Nochmals?" -> Stufenauswahl, Ende nur per Esc. storage.py und net.py gelöscht, 48 Tests.

This commit is contained in:
Project Bridge committed 2026-11-01 10:48:52 +00:00
1 parent de550e1d4d
commit d970185e75
15 files changed
+613 -342

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
"""Schwierigkeitsstufen: wie schnell die Koffer einlaufen.
``hard`` entspricht dem Tempo des Altstands (6 bzw. 2 Pixel pro Frame bei
120 fps = 720 bzw. 240 Pixel pro Sekunde).
"""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class Difficulty:
"""Eine Stufe. ``speed_fast`` gilt bis kurz vor der Barriere, dann ``speed_slow``."""
key: str
label: str
speed_fast: float
speed_slow: float
def __str__(self) -> str:
return self.label
DIFFICULTIES: tuple[Difficulty, ...] = (
Difficulty("easy", "Easy", speed_fast=420.0, speed_slow=140.0),
Difficulty("normal", "Normal", speed_fast=570.0, speed_slow=190.0),
Difficulty("hard", "Hard", speed_fast=720.0, speed_slow=240.0),
)
DEFAULT_DIFFICULTY: Difficulty = DIFFICULTIES[1]
def by_key(key: str) -> Difficulty:
for difficulty in DIFFICULTIES:
if difficulty.key == key:
return difficulty
return DEFAULT_DIFFICULTY