Opencode gesagt er soll die Docstrings und Type hints noch ergänzen
This commit is contained in:
1 parent
a8901dae2f
commit
cb85e8b86c
4 files changed
+9
-10
No files matched your search
@@ -23,7 +23,7 @@ class Apollo(Moon):
|
|||||||
super().__init__(title, fps, size)
|
super().__init__(title, fps, size)
|
||||||
self.position_apollo: Point = (APOLLO_DISTANCE, 0.0) # relativ zum Mond
|
self.position_apollo: Point = (APOLLO_DISTANCE, 0.0) # relativ zum Mond
|
||||||
# doppelte Winkelgeschwindigkeit, entgegengesetzte Drehrichtung
|
# doppelte Winkelgeschwindigkeit, entgegengesetzte Drehrichtung
|
||||||
self.rot_apollo = rot_2d(-2 * self.theta, unit="rad")
|
self.rot_apollo: list[list[float]] = rot_2d(-2 * self.theta, unit="rad")
|
||||||
|
|
||||||
def update_game(self) -> bool:
|
def update_game(self) -> bool:
|
||||||
"""Bewegt erst den Mond, dann Apollo."""
|
"""Bewegt erst den Mond, dann Apollo."""
|
||||||
|
|||||||
+2
-3
@@ -8,7 +8,7 @@ from typing import Literal
|
|||||||
|
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
|
|
||||||
__all__ = ["matmul", "rot_2d", "rotate", "transpose"]
|
__all__ = ["matmul", "print_matrix", "rot_2d", "rotate", "transpose"]
|
||||||
|
|
||||||
_NUMERIC_TYPES = (int, float)
|
_NUMERIC_TYPES = (int, float)
|
||||||
|
|
||||||
@@ -259,7 +259,6 @@ if __name__ == "__main__":
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
print("All tests passed.")
|
print("All tests passed.")
|
||||||
#This is a test commit
|
# This is a test commit
|
||||||
print("This is a test")
|
print("This is a test")
|
||||||
if __name__ == "__main__":
|
|
||||||
print(tabulate(rot_2d(1.0)))
|
print(tabulate(rot_2d(1.0)))
|
||||||
@@ -75,9 +75,7 @@ class Game:
|
|||||||
Returns:
|
Returns:
|
||||||
``False`` bei ``pygame.QUIT``, sonst ``True``.
|
``False`` bei ``pygame.QUIT``, sonst ``True``.
|
||||||
"""
|
"""
|
||||||
if event.type == pygame.QUIT:
|
return event.type != pygame.QUIT
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def update_game(self) -> bool:
|
def update_game(self) -> bool:
|
||||||
"""Aktualisiert den Spielzustand um einen Frame.
|
"""Aktualisiert den Spielzustand um einen Frame.
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""Simulation eines um die Erde kreisenden Mondes mit pygame."""
|
||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
from compute import matmul, rot_2d, transpose
|
from compute import matmul, rot_2d, transpose
|
||||||
@@ -25,9 +27,9 @@ class Moon(Game):
|
|||||||
"""Legt Startposition, Drehwinkel und Rotationsmatrix fest."""
|
"""Legt Startposition, Drehwinkel und Rotationsmatrix fest."""
|
||||||
super().__init__(title, fps, size)
|
super().__init__(title, fps, size)
|
||||||
self.position_moon: Point = (MOON_DISTANCE, 0.0) # relativ zur Erde
|
self.position_moon: Point = (MOON_DISTANCE, 0.0) # relativ zur Erde
|
||||||
self.theta = 0.01 # radian per frame
|
self.theta: float = 0.01 # radian per frame
|
||||||
self.rot_moon = rot_2d(self.theta, unit="rad")
|
self.rot_moon: list[list[float]] = rot_2d(self.theta, unit="rad")
|
||||||
self.center = (size[0] // 2, size[1] // 2)
|
self.center: tuple[int, int] = (size[0] // 2, size[1] // 2)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def rotate(point: Point, rotation: list[list[float]]) -> Point:
|
def rotate(point: Point, rotation: list[list[float]]) -> Point:
|
||||||
|
|||||||
Reference in new issue
Block a user