コード例 #1
0
ファイル: board.py プロジェクト: patrickbucher/tictactoe
 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))
コード例 #2
0
ファイル: board.py プロジェクト: patrickbucher/tictactoe
 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