diff --git a/compute.py b/compute.py index 98d9800..d466f8c 100644 --- a/compute.py +++ b/compute.py @@ -103,17 +103,12 @@ def transpose(matrix: Matrix) -> list[list[float]]: Alle Zeilen werden zu Spalten und alle Spalten zu Zeilen. Parameters - ---------- matrix Matrix in Form ``Sequence[Sequence[float]]``. - Returns - ------- list[list[float]] Die transponierte Matrix. - Raises - ------ ValueError Wenn ``matrix`` leer ist oder nicht gleichmäßig viele Spalten in den Zeilen hat. @@ -167,8 +162,6 @@ if __name__ == "__main__": print("example 3 passed:", error) - # end of main guard - diff --git a/moon.py b/moon.py index 8810f4d..1a0d02c 100644 --- a/moon.py +++ b/moon.py @@ -25,18 +25,22 @@ BLUE = (0, 0, 255) class Moon(Game): - """Demonstrates a moon orbiting the Earth using matrix rotation.""" def __init__(self, title: str = "Moon", fps: int = 60, size: Tuple[int, int] = (640, 400)) -> None: super().__init__(title, fps, size) # Earth centre – centre of the window self.center: Tuple[int, int] = (size[0] // 2, size[1] // 2) # Fixed orbit offset from the centre - self.offset: Tuple[float, float] = (100.0, 0.0) + self.offset: Tuple[float, float] = (150.0, 0.0) # Angular speed (radians per frame) self.delta_theta: float = 0.01 self.theta: float = 0.0 self.rot_moon: list[list[float]] = rot_2D(self.theta) + # Initial moon position + self.position_moon = ( + self.center[0] + self.offset[0], + self.center[1] + self.offset[1], + ) def update_game(self) -> bool: # Advance the angle and recompute the rotation matrix