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
+13
-14
No files matched your search
@@ -23,7 +23,7 @@ class Apollo(Moon):
|
||||
super().__init__(title, fps, size)
|
||||
self.position_apollo: Point = (APOLLO_DISTANCE, 0.0) # relativ zum Mond
|
||||
# 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:
|
||||
"""Bewegt erst den Mond, dann Apollo."""
|
||||
@@ -44,4 +44,4 @@ class Apollo(Moon):
|
||||
|
||||
if __name__ == "__main__":
|
||||
apollo = Apollo()
|
||||
apollo.run()
|
||||
apollo.run()
|
||||
+3
-4
@@ -8,7 +8,7 @@ from typing import Literal
|
||||
|
||||
from tabulate import tabulate
|
||||
|
||||
__all__ = ["matmul", "rot_2d", "rotate", "transpose"]
|
||||
__all__ = ["matmul", "print_matrix", "rot_2d", "rotate", "transpose"]
|
||||
|
||||
_NUMERIC_TYPES = (int, float)
|
||||
|
||||
@@ -259,7 +259,6 @@ if __name__ == "__main__":
|
||||
print()
|
||||
|
||||
print("All tests passed.")
|
||||
#This is a test commit
|
||||
# This is a test commit
|
||||
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:
|
||||
``False`` bei ``pygame.QUIT``, sonst ``True``.
|
||||
"""
|
||||
if event.type == pygame.QUIT:
|
||||
return False
|
||||
return True
|
||||
return event.type != pygame.QUIT
|
||||
|
||||
def update_game(self) -> bool:
|
||||
"""Aktualisiert den Spielzustand um einen Frame.
|
||||
@@ -95,4 +93,4 @@ class Game:
|
||||
"""Startet das Spiel: Initialisierung, Hauptschleife, Beenden."""
|
||||
self.init_game()
|
||||
self.game_loop()
|
||||
self.exit_game()
|
||||
self.exit_game()
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Simulation eines um die Erde kreisenden Mondes mit pygame."""
|
||||
|
||||
import pygame
|
||||
|
||||
from compute import matmul, rot_2d, transpose
|
||||
@@ -25,9 +27,9 @@ class Moon(Game):
|
||||
"""Legt Startposition, Drehwinkel und Rotationsmatrix fest."""
|
||||
super().__init__(title, fps, size)
|
||||
self.position_moon: Point = (MOON_DISTANCE, 0.0) # relativ zur Erde
|
||||
self.theta = 0.01 # radian per frame
|
||||
self.rot_moon = rot_2d(self.theta, unit="rad")
|
||||
self.center = (size[0] // 2, size[1] // 2)
|
||||
self.theta: float = 0.01 # radian per frame
|
||||
self.rot_moon: list[list[float]] = rot_2d(self.theta, unit="rad")
|
||||
self.center: tuple[int, int] = (size[0] // 2, size[1] // 2)
|
||||
|
||||
@staticmethod
|
||||
def rotate(point: Point, rotation: list[list[float]]) -> Point:
|
||||
@@ -64,4 +66,4 @@ class Moon(Game):
|
||||
|
||||
if __name__ == "__main__":
|
||||
moon = Moon()
|
||||
moon.run()
|
||||
moon.run()
|
||||
Reference in new issue
Block a user