# Time:  O(1), per move.
# Space: O(n^2)

class TicTacToe(object):

    def __init__(self, n):
        """
        Initialize your data structure here.
        :type n: int
        """
        self.__rows = [[0, 0] for _ in xrange(n)]
        self.__cols = [[0, 0] for _ in xrange(n)]
        self.__diagonal = [0, 0]
        self.__anti_diagonal = [0, 0]
        

    def move(self, row, col, player):
        """
        Player {player} makes a move at ({row}, {col}).
        @param row The row of the board.
        @param col The column of the board.
        @param player The player, can be either 1 or 2.
        @return The current winning condition, can be either:
                0: No one wins.
                1: Player 1 wins.
                2: Player 2 wins.
        :type row: int
        :type col: int
        :type player: int
        :rtype: int
        """
        self.__rows[row][player - 1] += 1
        self.__cols[col][player - 1] += 1
        if row == col:
            self.__diagonal[player - 1] += 1
        if col == len(self.__rows) - row - 1:
            self.__anti_diagonal[player - 1] += 1
        if any([self.__rows[row][player - 1] == len(self.__rows), \
                self.__cols[col][player - 1] == len(self.__cols), \
                self.__diagonal[player - 1] == len(self.__rows), \
                self.__anti_diagonal[player - 1] == len(self.__cols)]):
            return player

        return 0


# Your TicTacToe object will be instantiated and called as such:
# obj = TicTacToe(n)
# param_1 = obj.move(row,col,player)

@@ -864,32 +864,55 @@
 int%0A        %22%22%22%0A
+        i = player - 1%0A
         self.__r
@@ -920,26 +920,17 @@
 ws%5Brow%5D%5B
-player - 1
+i
 %5D += 1%0A 
@@ -953,26 +953,17 @@
 ls%5Bcol%5D%5B
-player - 1
+i
 %5D += 1%0A 
@@ -1008,34 +1008,25 @@
 .__diagonal%5B
-player - 1
+i
 %5D += 1%0A     
@@ -1099,26 +1099,17 @@
 iagonal%5B
-player - 1
+i
 %5D += 1%0A 
@@ -1140,26 +1140,17 @@
 ws%5Brow%5D%5B
-player - 1
+i
 %5D == len
@@ -1199,26 +1199,17 @@
 ls%5Bcol%5D%5B
-player - 1
+i
 %5D == len
@@ -1253,34 +1253,25 @@
 .__diagonal%5B
-player - 1
+i
 %5D == len(sel
@@ -1320,26 +1320,17 @@
 iagonal%5B
-player - 1
+i
 %5D == len

Update design-tic-tac-toe.py