我正在尝试创建一个引擎,但我的评估功能很糟糕,所以我决定使用 stockfish 来为我评估它。
import chess
import chess.engine
def stockfish_evaluation(board, time_limit = 0.01):
engine = chess.engine.SimpleEngine.popen_uci("stockfish/stockfish_10_x64")
result = engine.play(board, chess.engine.Limit(time=time_limit))
return result.info["score"]
board = chess.Board("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")
result = stockfish_evaluation(board)
print(result)
但它打印出来:
KeyError: 'score'