core: split: game and pong

This commit is contained in:
2024-04-05 17:47:17 +02:00
parent c49e721e5a
commit f6f59f8ead
34 changed files with 965 additions and 784 deletions

View File

@ -1,22 +1,27 @@
from __future__ import annotations
from .Point import Point
class Position:
def __init__(self, position = 0, time: int = 0) -> None:
def __init__(self, location: int | Point = 0, time: int = 0) -> None:
self.time = time
self.position = position
self.location = location
def copy(self):
return Position(self.position, self.time)
return Position(self.location, self.time)
def to_dict(self):
data: dict = {
"position": self.position,
"time": self.time,
}
try:
data.update({"location": self.location.to_dict()})
except:
data.update({"location": self.location})
return data
def __eq__(self, __value: Position) -> bool:
return (self.position == __value.position)
return (self.location == __value.location)