This commit is contained in:
kreischeran103444 committed 2026-10-22 14:34:28 +02:00
1 parent e02b552da3
commit ddaceeaffe
2 files changed
+6 -9

No files matched your search

-7
View File
@@ -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
+6 -2
View File
@@ -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