aboutsummaryrefslogtreecommitdiff
path: root/src/game.py
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-02-19 12:57:27 +0100
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-02-19 12:57:27 +0100
commit7200fcf3f4e4c22193b5b96452f9aa5131b1bc1c (patch)
tree812cf7b0f7a25b865d694199e9e4d29714a72fd3 /src/game.py
parent4f87f915ef7c6b8f20f70d35ff675059326680bd (diff)
refactor: Move to src
Diffstat (limited to 'src/game.py')
-rw-r--r--src/game.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/game.py b/src/game.py
new file mode 100644
index 0000000..0e8803c
--- /dev/null
+++ b/src/game.py
@@ -0,0 +1,14 @@
+from dataclasses import dataclass
+from datetime import datetime
+
+from src.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)"