From b787fc21943c83ca0ddd9d700c6ea90ee2f230bb Mon Sep 17 00:00:00 2001 From: YoEnte Date: Thu, 3 Dec 2026 20:23:19 +0100 Subject: [PATCH] add deepcopy (and ne) to gamestate --- python/socha/_socha.pyi | 4 ++++ src/plugin2027/game_state.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/python/socha/_socha.pyi b/python/socha/_socha.pyi index 191262a..49804ce 100644 --- a/python/socha/_socha.pyi +++ b/python/socha/_socha.pyi @@ -398,6 +398,10 @@ class GameState: last_move_mono: dict[Color, bool] | None = None, ) -> None: ... def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + + def deepcopy(self) -> GameState: + """Erstellt eine unabhängige Kopie des Spielstandes.""" def round(self) -> int: """Die aktuelle Rundenzahl.""" diff --git a/src/plugin2027/game_state.rs b/src/plugin2027/game_state.rs index 42054c6..cc48070 100644 --- a/src/plugin2027/game_state.rs +++ b/src/plugin2027/game_state.rs @@ -59,6 +59,10 @@ impl GameState { } } + fn __eq__(&self, other: &GameState) -> bool {self == other} + fn __ne__(&self, other: &GameState) -> bool {self != other} + fn deepcopy(&self) -> GameState {self.clone()} + fn round_from_turn(&self, turn: usize) -> usize { 1 + turn / Constants::COLORS }