Eclipse/Druss99 31c80dfd02 refactor of previous commits
refactor to enum

typing and many other fixes

fix tests

attempt to fix some typescript

more typescript fixes

more typescript test fixes

revert all API changes

update to pydcs

mypy fixes

Use properties to check if player is blue/red/neutral

update requirements.txt

black -_-

bump pydcs and fix mypy

add opponent property

bump pydcs
2025-10-19 19:34:38 +02:00

31 lines
695 B
Python

from enum import Enum
class Player(Enum):
NEUTRAL = "Neutral"
BLUE = "Blue"
RED = "Red"
@property
def is_red(self) -> bool:
"""Returns True if the player is Red."""
return self == Player.RED
@property
def is_blue(self) -> bool:
"""Returns True if the player is Blue."""
return self == Player.BLUE
@property
def is_neutral(self) -> bool:
"""Returns True if the player is Neutral."""
return self == Player.NEUTRAL
@property
def opponent(self) -> "Player":
"""Returns the opponent player."""
if self.is_blue:
return Player.RED
else:
return Player.BLUE