15 lines
290 B
Python
15 lines
290 B
Python
from enum import Enum
|
|
|
|
class Player(Enum):
|
|
BLACK = 0
|
|
WHITE = 1
|
|
|
|
def next(self):
|
|
cls = self.__class__
|
|
members = list(cls)
|
|
index = members.index(self) + 1
|
|
if index >= len(members):
|
|
index = 0
|
|
return members[index]
|
|
|