more cool stuff
chess, woah
This commit is contained in:
14
chess/player.py
Normal file
14
chess/player.py
Normal file
@@ -0,0 +1,14 @@
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user