title: stuck with checking a winning condition and defining a function to move in python game
body: <p>I'm working on a Tic Tac Toe game with a custom grid size and a custom length of the winning line (from input).</p>
  
  <p>The winning conditions that I have, check if there are N-times of the same player's letter horizontally, vertically or diagonally but they don't see if the moves are next to each other (so if they make a line). They only check if there's particular amount of same letter throughout the length of the grid.</p>
  
  <p>I'd appreciate any tips on this.</p>
  
  <pre><code>#find the winner based on row, colum or diagonal downward/upward
  def winnerFind(board, player, winLineLength):
  
      tempVar=[]
      for g in range(len(board)):
          if listSum(board[g]) == winLineLength or listSum(board[g]) == -winLineLength:
              print(player, "wins!")
              exit()
  
      for t in range(len(board)):
          for u in range(len(board)):
              tempVar.append(board[u][t])
          if listSum(tempVar)== winLineLength or listSum(tempVar)== -winLineLength:
              print(player, "wins!")
              exit()
          else:
              tempVar=[]
      tempVar=[]
  
      for a in range(len(board)):
          tempVar.append(board[a][a])
      if listSum(tempVar)== winLineLength or listSum(tempVar)== -winLineLength:
          print(player, "wins!")
          exit()
  
      tempVar=[]
      for s in range(len(board)):
          tempVar.append(board[-s-1][s])
      if listSum(tempVar)== winLineLength or listSum(tempVar)== -winLineLength:
          print(player, "wins!")
          exit()
  </code></pre>