算法用于评估具有自定义棋子和不同棋盘形状的国际象棋局面。

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

Algorithm for evaluating chess positions with custom pieces and different board shapes

问题

我正在设计一个国际象棋游戏,将具有一个AI对手供玩家对战。用户还可以通过组合已解锁的现有棋子的行为(例如Heroine;一个皇后和马的混合体)以及全新的棋子来创建其起始阵容,并且将包括不同于原始8x8的新棋盘形状。

然后问题在于如何设计AI。我决定从简单开始,尝试使用alpha-beta剪枝的极小化算法,但问题出现在如何评估局势上。

评估一个包含无法在编译时确定的新棋子和新棋盘形状的局势是我没有看到人们提到的问题,因此我不知道如何处理它。简单地对每个棋子价值进行分数累加也不太适用,因为你无法为自定义棋子评分。我知道Alpha Zero和其他国际象棋引擎使用大型神经网络来评估局势。

编辑:我与一位朋友讨论了可能的体系结构,并考虑了一个理论体系结构,其中每个自定义棋子的行为被编码为一个二进制字符串,然后与棋盘布局(也将是一个二进制字符串)相结合,以创建MLP评估函数的第一个输入层,该函数将具有一个输出神经元,输出一个数字,该数字是局势的评估(通常情况下,对白色为正,对黑色为负)。

然后,将评估函数放入极小化中创建一个AI机器人,并使用这个机器人让它与自己对战,并使用游戏的结果(白方获胜为1,黑方获胜为0)来创建成本函数 - 如果白方获胜,那么白方的评估函数应该大多数时间将局势评估为正。

当然,这并不能防止对手可能犯下的突然错误,这会完全改变游戏的局势,尽管他们可能在大部分时间里都处于优势。为了纠正这一点,我们让相同的模型多次进行相同的对战,但每次都添加随机噪声到棋步中。

我不知道这是否会起作用,我希望一些AI专家能指出任何缺陷或替代方案。

英文:

I am in the process of designing a chess game which will feature an AI opponent to play against. The user will also have the ability to create custom chess pieces for their starting lineup by combining behaviours of current pieces they have unlocked (for example a Heroine; a hybrid of Queen and Horse) plus completely new pieces, and will also feature new board shapes different to the original 8x8.

The question then is how to design the AI. I decided I will start simple and try the minimax algorithm with alpha-beta pruning, but the problem arises in determining how to evaluate the position.

Evaluating a position with new pieces and new board shapes that can't be pre-determined at compile-time is something I have not seen people mention much, so I am stuck on how to even approach it. A simple point-wise sum of each piece value doesn't really work either because you can't score how the custom pieces. I am aware that Alpha Zero and other chess engines use a large neural network for evaluating their position.

Edit: I discussed possible architectures with a friend of mine, and we considered a theoretical architecture where the behaviour of each custome piece is encoded in a binary string, which is then combined with the board layout (which would also be a binary string) to create the first input layer of a MLP for the evaluation function, which would have a single output neuron, which outputs a number which is the evaluation of the position (positive for white and negative for black as usual).

The evaluation function is then put in a minimax to create an AI bot, and using this we make it play against itself, and to train the evaluation function we get the result of the game (1 for white wins and 0 for black) and use that to create a cost function - if white wins, then the eval function for white should have been evaluating the position as positive most of the time.

Of course, this doesn't protect against sudden mistakes the opponent may make, which completely change the tide of the game, even though they may have been winning most of the time. To rectify this, we play the same model against itself with the same game multiple times, butting adding random noise to the moves each time.

I have no clue if this would work, and I'm hoping some AI experts could point out any flaws ro alternatives.

答案1

得分: 1

General Game Playing (GGP) 是一个人工智能领域,其中游戏规则在游戏开始前是未知的。因此,如果玩家解锁了新的自定义棋子移动方式,您可以将其编码为游戏描述语言 (GDL) 并进行游戏。有许多开源的玩家可用,如 Cadiaplayer、Sancho 等。

英文:

General Game Playing (GGP) is an AI field where the rules are not known in advance of game play. So if the player unlocked new custom piece moves, you could encode those into Game Description Language (GDL) and have it play. There are many open source players available, like Cadiaplayer, Sancho, and some others.

huangapple
  • 本文由 发表于 2023年3月15日 20:27:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744683.html
匿名

发表评论

匿名网友

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

确定