From 5d84156313a346539d72bb12ee4c3979417b507a Mon Sep 17 00:00:00 2001 From: kulisak12 Date: Tue, 20 Sep 2022 17:43:59 +0200 Subject: [PATCH] =?UTF-8?q?Strategick=C3=A1:=20Invert=20nefungovalo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- klient/play.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/klient/play.py b/klient/play.py index 4c68f0c..0fef742 100755 --- a/klient/play.py +++ b/klient/play.py @@ -14,16 +14,15 @@ class Action(enum.Enum): RIGHT = enum.auto() STAY = enum.auto() - _inversions = { - UP: DOWN, - DOWN: UP, - LEFT: RIGHT, - RIGHT: LEFT, - STAY: STAY, - } - def invert(self) -> Action: - return self._inversions[self] + INVERSIONS = { + Action.UP: Action.DOWN, + Action.DOWN: Action.UP, + Action.LEFT: Action.RIGHT, + Action.RIGHT: Action.LEFT, + Action.STAY: Action.STAY, + } + return INVERSIONS[self] def __str__(self) -> str: return self.name.lower()