aboutsummaryrefslogtreecommitdiff
path: root/game.py
diff options
context:
space:
mode:
Diffstat (limited to 'game.py')
-rw-r--r--game.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/game.py b/game.py
new file mode 100644
index 0000000..8c88f6e
--- /dev/null
+++ b/game.py
@@ -0,0 +1,14 @@
+from dataclasses import dataclass
+from datetime import datetime
+
+from player import Player
+
+
+@dataclass(frozen=True)
+class Game:
+ played_at: datetime
+ scores: dict[Player, int]
+
+ def __str__(self) -> str:
+ total_points = sum(self.scores.values())
+ return f"Game played at {self.played_at} ({total_points} total points)"