I'm trying to write a recursive function in python, but instead of returning an integer type it returns a nonetype. I know there are other questions smiliar to this but not a single solution there worked for me. Here is the code:
class t:
def search(self, globina, board):
board.legals = board.legal()
bestMove = 0
if(globina == 0):
return board.evaluation()
elif board.turn == False:
bestMove = -9999
for i in range(0, len(board.legals)):
board.move(board.legals[i])
board.display()
bestMove = max(bestMove, self.search(globina-1, board))
board.undo()
return bestMove
else:
bestMove = 9999
for i in range(0, len(board.legals)):
board.move(board.legals[i])
board.display()
bestMove = min(bestMove, self.search(globina-1, board))
board.undo()
return bestMove
z = t()
z.search(globina, board)