def Start(self): currentPlayer = self.player maxPlayer = True depth = self.maxDepth print self.state.boardState if currentPlayer == 'Star': isStar = True else: isStar = False if self.algorithm == 'MINIMAX': root = Node(self.state, None, self.player) score = self.Minimax(root, 0, maxPlayer, isStar) bestMove, score, farSightScore, numNodes = root.TermEvaluation( score, depth, isStar) print bestMove, score, farSightScore, numNodes with open('output.txt', 'w') as openFile: openFile.write(bestMove + '\n') openFile.write(str(score) + '\n') openFile.write(str(farSightScore) + '\n') openFile.write(str(numNodes)) elif self.algorithm == 'ALPHABETA': root = ABNode(self.state, None, self.player) alpha = -float("inf") beta = float("inf") score = self.AlphaBeta(root, 0, maxPlayer, isStar, alpha, beta) bestMove, score, farSightScore, numNodes = root.TermEvaluation( score, self.maxDepth, isStar) print bestMove, score, farSightScore, numNodes