title: Recursion function cooperating with another function python
body: <p>I am trying to make a game solver. It should be able to solve Sudoku i.e.
  find each possible number useable in each square.<br>
  This is what I have:</p>
  
  <pre><code>def next_possible_moves(board,row,col):
      possible_moves = set(range(1,len(board)+1))
      rows = set(board[row])
      cols = []
      for j in range(0,len(board)):
          cols.append(board[j][col])
      cols = set(cols)
      possible_moves = possible_moves - rows.union(cols)
      return list(possible_moves)
  
  def solve(board):
      for i in range(0,len(board)):
          if len(board) == 8 and len(board[i]):
              print "Found a solution:", board
              return True
  
      for next_move in next_possible_moves(board):
          if is_valid(board, next_move):
  
              if solve(board + [next_move]):
                  return True
  
      return False
  </code></pre>
  
  <p>Both are working, but I am not able to get them to work together. I am using recursion to make it use one number, and while going through the code, it will backtrack if it fails.</p>
  
  <p>What I want is for next_possible_moves to use only one parameter, so I can remove "row" and "col".</p>
  
  <p>Using a list with X lists inside, so it represent an "X times X" board.</p>