def set(self, pos, player): index = pos - 1 if self.board[ index] == Fields.EMPTY.value and player in Fields.players(): self.board[index] = player else: raise ValueError('cannot set {:s} to {:d}'.format(player, pos))
def sublist_with_all_of_same(self, lists): for player in Fields.players(): for sublist in lists: if self.all_of_same(sublist, player): return player return None