我不明白极小极大算法是什么

发布于 2024-11-09 01:54:15 字数 291 浏览 0 评论 0原文

我有一个关于极小极大算法的问题。

假设我有以下游戏树,并且我向其中添加了一些随机启发值。

在此处输入图像描述

据我了解极小极大算法,它将选择绿色路径。然而,在这种情况下这可能不是最好的选择。因为顶部节点的右子节点具有它可以获得的最高值,所以这不是最好的移动...

因为如果其他玩家执行另一个移动,我的获胜机会就会少得多...

我很抱歉,我很难表达我对这个问题的意思。但我这里怎么想错了?

I have a question about the minimax algorithm.

Lets say I have the following game tree, and I've added some random heuristic values to it.

enter image description here

As I've understood the minimax algorithm, it will choose the green path. However, this might not be the best thing to choose in the situation. Because the right child of the top node, has the HIGHEST value that it can get, it's not the best move...

Since if the other player does the other move, my win chance is much less...

I'm sorry, I'm having a hard time expressing what I mean on this question. But how am I thinking wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

流年已逝 2024-11-16 01:54:15

解决这个问题的通常方法是从树的较低层向后进行。我们首先检查最下面的四片叶子(10-20-15-20 部分)。如果游戏到达那里,玩家 2 可以从中进行选择,因此 P2 将选择较小的,即 10 和 15。然后我们可以修剪树的 10-20-15-20 分支并将它们替换为 10(最左边的两片叶子)和 15(最右边的两片叶子)。类似地,我们可以修剪中间的 -100 - 50 对,并用 -100 替换它们(不是像你那样的 50,因为在这个级别轮到玩家 2,他会选择较小的结果),-200 - - 100对与-200等。因此,对我来说,情况似乎是在每个分支点取最大值,而不是在最大值和最小值之间交替。

The usual way to solve this is to proceed backwards from the lower layers of the tree. Let's check the lowermost four leaves first (the 10-20-15-20 part). Player 2 gets to choose from these if the game ever gets there, so P2 will choose the smaller ones, i.e. 10 and 15. We can then prune the 10-20-15-20 branches of the tree and replace them with 10 (for the leftmost two leaves) and 15 (for the rightmost two). Similarly, we can prune the -100 - 50 pair at the middle and replace them with -100 (not 50 as you did, because at this level it is player 2's turn and he will choose the smaller outcome), the -200 - -100 pair with -200 and so on. So, for me, it seems to be the case that you are taking the maximum at each branching point instead of alternating between the maximum and the minimum.

爱殇璃 2024-11-16 01:54:15

您应该交替采用最小值和最大值。如果你想取 50,即 30 和 50 中的最大值,那么你应该选择右侧低一级的 -100,等等。这就是该算法被称为 minimax 的原因。

You should alternate between taking the minimum and maximum. If you want to take 50, which is the maximum of 30 and 50, then you should have chosen -100 one level lower on the right side instead, etc.. That's why the algorithm is called minimax.

猫性小仙女 2024-11-16 01:54:15

该算法假设您和第二位玩家都想获胜,并且总是会选择最好的棋步。因此,在问题树中 - 正如我在评论中所说,最后一步(第二个玩家所做的)是向左而不是向右。这会导致整个右子树 - 对于第一个玩家来说不值得,并且 minmax 算法将选择以下路径(而不是按照问题中的描述): left->left->right->left

这是真的,算法“让你获胜的机会更少”,这是因为有第二个玩家也想获胜!

看看他的示例

在这里,x 玩家想要避免失败,所以他在第一步中追求“0”。请注意,如果(在示例中)他首先向左走,那么第二个玩家就会再次向左走并获胜!该算法确保了最佳可能性 - 假设第二个玩家也采取相同的行为(并假设它知道整个游戏树)

the algorithm assumes both you and the 2nd player wants to win, and will always choose the best move. thus, in the question's tree - as I said in the comment, the last move (2nd player makes) is left and not right. this results in making the whole right subtree - unworthy for the first player, and the minmax algorithm will choose the following path (and not as described in the question): left->left->right->left

this is true the algorithm "gives you less chance to win" this is because of the fact that there is a 2nd player, who wants to win as well!

have a look at his example.

in here, the x player wants to avoid defeat so he persues the '0' in the first step. note that if (in the example) he would take first left, the 2nd player then takes left again and wins! the algorithm assures best possibility - asuuming the 2nd player acts the same as well (and assuming it knows the whole game tree)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文