|
@ -14,16 +14,15 @@ class Action(enum.Enum): |
|
|
RIGHT = enum.auto() |
|
|
RIGHT = enum.auto() |
|
|
STAY = enum.auto() |
|
|
STAY = enum.auto() |
|
|
|
|
|
|
|
|
_inversions = { |
|
|
|
|
|
UP: DOWN, |
|
|
|
|
|
DOWN: UP, |
|
|
|
|
|
LEFT: RIGHT, |
|
|
|
|
|
RIGHT: LEFT, |
|
|
|
|
|
STAY: STAY, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def invert(self) -> Action: |
|
|
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: |
|
|
def __str__(self) -> str: |
|
|
return self.name.lower() |
|
|
return self.name.lower() |
|
|