对鳕鱼干的 FEN 评估错误

问题描述 投票:0回答:1

我正在尝试评估鳕鱼干的 FEN 位置。 鉴于这个立场:

rnbqkbnr/pppp1p1p/8/4p3/P3P1p1/5N2/1PPP1PPP/RNBQKB1R b KQkq - 0 4
和鳕鱼干 16.

这是立场板图片:

this is the position board picture

我这样做:

./stockfish

ucinewgame
position fen rnbqkbnr/pppp1p1p/8/4p3/P3P1p1/5N2/1PPP1PPP/RNBQKB1R b KQkq - 0 4
go movetime 1000

输出的最后一行内容为:

info depth 26 seldepth 33 multipv 1 score cp 361 nodes 3134961 nps 1566697 hashfull 910 tbhits 0 time 2001 pv g4f3 d2d4 f3g2 f1g2 d7d6 a4a5 g8f6 a1a3 e5d4 c1g5 f8e7 e1g1 h7h6 g5h4 b8c6 a5a6 a8b8 f2f4 h8g8 a3g3 e8f8 e4e5 d6e5 f4e5 c6e5 g3g8 f6g8
bestmove g4f3 ponder d2d4

所以,位置评价是+3.6。这是绝对错误的。

我尝试向 FEN 提供引号和双引号,但没有成功。

我还尝试使用python来评估国际象棋模块的位置:

import chess
import chess.engine
import re

def extract_numerical_score(stockfish_output):
    # Define a regex pattern to match numbers
    pattern = r"[-+]?\d+"
    
    # Use re.findall to extract all numbers from the string
    numbers = re.findall(pattern, stockfish_output)
    
    return numbers[0] if numbers else None


board = chess.Board("rnbqkbnr/pppp1p1p/8/4p3/P3P1p1/5N2/1PPP1PPP/RNBQKB1R b KQkq - 0 4")

stockfish_path = r"Z:\Tools\stockfish-windows-x86-64-avx2.exe"

# Open the Stockfish engine
engine = chess.engine.SimpleEngine.popen_uci(stockfish_path)
            # Analyze the position using Stockfish for 5.0 seconds
analysis = engine.analyse(board, chess.engine.Limit(time=5.0))

            # Extract numerical score from Stockfish output
numerical_score = extract_numerical_score(str(analysis["score"]))
print(numerical_score)

但结果是一样的。

有趣的是,当我将 FEN 位置粘贴到 Lichess 和 Chess.com 时,Lichess 和 Chess.com 都显示了正确的评估。

引擎似乎无法正确理解颜色,因为评估几乎是正确的,但符号错误!位置大概是-3.6左右。 它还可以找到最好的走法,将马带到这个位置。

根据我的理解,FEN 位置应该具备单个国际象棋位置所需了解的所有信息。

我在这里遗漏了什么吗?

python chess python-chess stockfish fen
1个回答
0
投票

因为轮到黑棋了。

cp
是从即将移动的玩家的角度计算的。黑方获胜,轮到黑方,所以
cp
分数为正。

另请参阅:https://chess.stackexchange.com/questions/21845/why-does-stockfish-give-a-negative-score-in-a-theoretical-win-for-white/

© www.soinside.com 2019 - 2024. All rights reserved.