gpt4 book ai didi

Can't make Python Stockfish weaker(不能让巨蟒变得更弱)

转载 作者:bug小助手 更新时间:2023-10-25 21:12:53 27 4
gpt4 key购买 nike



I’ve written a chess software in Python which use Stockfish via this library:
https://pypi.org/project/stockfish/

我已经用PYTHON写了一个国际象棋软件,它通过这个库使用了斯托克菲什:https://pypi.org/project/stockfish/


The software works and plays well. Too well actually…

该软件运行良好,运行良好。太好了,实际上是…


Mi idea was the app can offer a level / ELO choice, but I just can’t scale it down. It doesn’t matter if I use Stockfish or Fairy Stockfish seemingly none of the parameters has any effect, especially not the “Skill Level” or “Elo Parameter”.

我的想法是,这款应用程序可以提供关卡/ELO选项,但我就是不能缩小规模。不管我用的是斯托克鱼还是仙女斯托克鱼,这些参数似乎都不起作用,尤其是“技能水平”或“Elo参数”。


I tried multiple combination it’s only an example:

我尝试了多种组合,这只是一个例子:


params = {
"Debug Log File": "",
"Contempt": 0,
"Min Split Depth": 0,
"Threads": 2, # More threads will make the engine stronger, but should be kept at less than the number of logical processors on your computer.
"Ponder": False,
"Hash": 512, # Default size is 16 MB. It's recommended that you increase this value, but keep it as some power of 2. E.g., if you're fine using 2 GB of RAM, set Hash to 2048 (11th power of 2).
"MultiPV": 1,
"Skill Level": 1,
"Move Overhead": 10,
"Minimum Thinking Time": 20,
"Slow Mover": 100,
"UCI_Chess960": False,
"UCI_LimitStrength": True,
"UCI_Elo": 1000
}

#stockfish = Stockfish(path="/usr/games/stockfish", parameters = params)
stockfish = Stockfish(path="/home/python/chess/fairy-stockfish_x86-64", parameters = params)

更多回答

Try using Engine.configure or setoptions to set "Skill level". Maybe it doesn't work went sent in Params? chess.stackexchange.com/questions/34504/…

试着使用Engine.configuration或setOptions来设置“技能水平”。也许它不起作用,送去了护理队?Chess.stackexchange.com/Questions/34504/…

I use a different library as I wrote, but thanks.

我写的时候用的是不同的图书馆,不过还是谢谢你。

If you're insinuating that I downvoted your question, I have in fact not voted on it in either direction. Could you clarify how you are verifying that StockFish is not getting weaker? Have you played a low skill level vs a high skill level? Are you enforcing time limits for move calculations? You commented on the answer below that maybe the setting don't work on newer versions, but the official docs indicate you can set the strength by adjusting either skill level or ELO on the most current version. The Fairy-Stockfish documentation states the lowest skill level is -20

如果你是在暗示我否决了你的问题,事实上我还没有对这两个方向都进行过投票。你能澄清一下你是如何核实鳕鱼没有变弱的吗?你有没有打过低水平和高水平的比赛?您是否强制执行移动计算的时间限制?你在下面的回答中评论说,也许这个设置在新版本上不起作用,但官方文档表明,你可以通过调整最新版本的技能等级或ELO来设置强度。仙女-斯托克菲什的文档指出,最低技能级别为-20

"I have in fact not voted on it in either direction." OMG, I didn't think it was you, I just guessed the reason, because people in general don't like duplicated questions. But it is NOT a duplicated one. The playing strength is very easily detectable as I have some experience with chess and also it is very is to test it against any other engine... And I did this comparison of course.

“事实上,我还没有对这两个方向都进行过投票。”天哪,我没想到是你,我只是猜测了原因,因为人们一般不喜欢重复的问题。但它不是复制的。棋力是很容易察觉的,因为我对国际象棋有一些经验,而且很难与任何其他引擎进行测试。当然,我做了这个比较。

And thanks for your answer, now I tried -20 too, but nothing changed. I've to think it is an outdated library...

谢谢你的回答,现在我也试了-20,但什么都没有改变。我不得不认为这是一个过时的图书馆。

优秀答案推荐

Documentation(https://pypi.org/project/stockfish/) says:

Documentation(https://pypi.org/project/stockfish/)说:



You can change them, as well as the default search depth, during your
Stockfish class initialization:



stockfish = Stockfish(path="/Users/zhelyabuzhsky/Work/stockfish/stockfish-9-64", depth=18, parameters={"Threads": 2, "Minimum Thinking Time": 30})

i think what controlls the difficulty might be the depth=18 parameter.

我认为控制难度的可能是Depth=18参数。



i have played both stockfish 15.1 and 16 at very low skill levels and have beaten it or found a way to beat it. the program blunders material when the evaluation is very bad for the engine and also it makes objectively weaker moves like useless pawn moves .it is more likely to play another move altogether after it finishes analysing the correct one. its kind of fun to play an engine that makes positional errors that you must prove are errors! often you will find tactical ideas to advance your play that stock will never let you imagine at high strength.i played 15.1 on 3 and 16 on two. 15 is more human like in my opinion but will still challenge you because it usually creates good structures and is still aggressive often never connecting rooks so as to use the g file with a bishop on the long diagnal cooperating. and a wild a or h pawn terrorizing you.if that is a common scenario for you its great practice!if it crushes you even on 2 you can go back to where you started to lose your way and try something else.usually there is some recourse available to you if the evaluation is in your favor.

我在非常低的技术水平下玩过15.1和16号鱼,但我已经击败了它,或者找到了击败它的方法。当评估对引擎非常不利时,程序会出错,而且它会做出客观上较弱的动作,比如无用的棋子动作。它更有可能在分析完正确的棋子后,完全玩另一个动作。这是一种有趣的游戏引擎,它的位置错误,你必须证明是错误的!通常你会找到战术想法来推进你的比赛,这些想法永远不会让你在高强度的情况下想象。我在3分打了15.1分,在2分打了16分。15在我看来更像人类,但仍然会挑战你,因为它通常会创造良好的结构,而且仍然很有侵略性,经常从不连接机头,从而使用g文件与主教对角线上的长时间合作。一个狂野的a或h棋子威胁着你。如果这对你来说是一个常见的场景,那就是伟大的练习!如果它在2岁的时候就把你压垮了,你可以回到你开始迷失方向的地方,尝试其他的东西。如果评估结果对你有利,你通常会有一些可以求助的方法。



It started to work and it can play significantly weaker. I tried multiple things (like boolean variables are string), but I think key factors are:

它开始工作,它可以发挥显着较弱。我尝试了多种方法(比如布尔变量是字符串),但我认为关键因素是:



  • depth = 1

  • "MultiPV": 5 (as it gives options to the Engine and on weaker levels it has a tendency to choose a weaker move)


params = {
"Debug Log File": "",
"Contempt": 0,
"Min Split Depth": 0,
"Threads": 2, # More threads will make the engine stronger, but should be kept at less than the number of logical processors on your computer.
"Ponder": "false",
"Hash": 512, # Default size is 16 MB. It's recommended that you increase this value, but keep it as some power of 2. E.g., if you're fine using 2 GB of RAM, set Hash to 2048 (11th power of 2).
"MultiPV": 5,
"Skill Level": 0,
"Move Overhead": 10,
"Minimum Thinking Time": 20,
"Slow Mover": 100,
"UCI_Chess960": "false",
"UCI_LimitStrength": "false",
}

stockfish = Stockfish(path="/home/python/chess/fairy-stockfish_x86-64", depth=1, parameters = params)

更多回答

Some relevant discussion stackoverflow.com/questions/42509966/…

一些相关讨论STACKOVERFLOW.com/Questions/42509966/…

I tried to change the depth (as almost anything else), but it did nothing. I have to think maybe the options works only with Stockfish 9 and not with the newer versions...

我试着改变深度(就像其他任何东西一样),但没有效果。我不得不认为,这些选项可能只适用于StockFish 9,而不适用于较新的版本……

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com