以黑子开始在Stockfish Python中是什么。

huangapple go评论83阅读模式
英文:

who to start as black in stockfish python

问题

我正在尝试在Python中将Stockfish模块作为黑方玩家启动,而不是默认的白方。我一直在寻找有关如何做到这一点的参数或其他信息,但没有找到有效的方法。你能帮助我弄清楚如何在Python中以黑方启动Stockfish吗?

英文:

I'm trying to start the Stockfish module in Python as the black player instead of the default white. I've been looking for parameters or other information on how to do this, but haven't been able to find anything that works. Can you please help me figure out how to start Stockfish as black in Python?

答案1

得分: 1

module 提供了 set_fen_position 方法。您可以使用此方法将 stockfish 设置为执黑棋。

使用初始 FEN:

fen = "rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2"

将走棋方从 w 改为 b

fen_b = "rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 2"

最后,在方法中使用此 FEN。

stockfish.set_fen_position(fen_b)
英文:

The module has set_fen_position method. You can use this to set stockfish to play as black.

Take the start fen:

fen = "rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2"

Change the side to move from w to b.

fen_b = "rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 2"

Finally use this fen in the method.

stockfish.set_fen_position(fen_b)

huangapple
  • 本文由 发表于 2023年2月23日 22:44:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75546363.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定