minimax算法_使用Minimax算法玩策略游戏

minimax算法

In this lesson, we’ll explore a popular algorithm called minimax. We’ll also learn some of its friendly neighborhood add-on features like heuristic scores, iterative deepening, and alpha-beta pruning. Using these techniques, we can create a more flexible and powerful game playing agent. It’ll be able to compete in many challenges, including the strategy game Isolation.

在本课程中,我们将探讨一种流行的算法,称为minimax 。 我们还将学习其一些友好的社区附加功能,例如启发式得分迭代加深alpha-beta修剪 。 使用这些技术,我们可以创建一个更加灵活和强大的游戏代理。 它将能够应对许多挑战,包括策略游戏“隔离”。

In my previous post How To Win Sudoku, we learned how to teach computers to solve the puzzle Sudoku. If you haven’t read it, go ahead and give it a quick read. But that was really just a way to get our feet wet, before diving into more sophisticated methods of game playing agents. Especially those methods that can make strategic moves against an opponent!

在我之前的文章How To Win Sudoku中 ,我们学习了如何教计算机解决数独难题。 如果您还没有阅读,请继续阅读。 但这实际上只是在深入研究更复杂的游戏代理方法之前弄湿我们的方法。 尤其是那些可以对对手采取战略行动的方法!

不要被搁浅 (Don’t Get Stranded)

Isolation (or Isola) is a turn-based strategy board game where two players try to confine their opponent on a 7x7 checker-like board. Eventually, they can no longer make a move (thus isolating them).

隔离(或Isola)是一种基于回合的策略棋盘游戏,其中两名玩家试图将其对手限制在7x7的类似棋盘格的棋盘上。 最终,他们无法采取任何行动(因此将其隔离)。

Each player has one piece, which they can move around like a queen in chess — up-down, left-right, and diagonal. There are three conditions under which the pieces can be moved —

每个玩家都有一个棋子,他们可以像国际象棋中的皇后一样四处移动-上下,左右和对角线。 在三种条件下可以移动棋子-

  1. They cannot place their piece on an already visited square.

    他们无法将自己的作品放置在已经访问过的广场上。
  2. They cannot cross over already visited squares (squeezing through them diagonally is OK).

    他们不能越过已经访问过的广场(对角地穿过它们可以)。
  3. They cannot cross over each other’s piece.

    他们不能越过对方的棋子。

In the above picture, you can see from the black squares that both players have placed their pieces on various parts of the board. But as the game progressed, it shows that the yellow player still has three possible moves. Up and to the right, right one square, and right two squares. But the blue player is out of options. Hence, the yellow player is the winner here.

在上图中,您可以从黑色方块中看到两个玩家都将棋子放置在棋盘的各个部分上。 但是随着比赛的进行,这表明黄色的球员仍然有3种可能的举动。 向上和向右,向右一个正方形和向右两个正方形。 但是蓝色球员没有选择。 因此,黄色玩家是这里的赢家。

Now this may seem like a simple game — and to be honest, it is. It’s not like we’re playing poker or Starcraft. Yet, there is still an enormous amount of possible moves either player can make at any point during the game.

现在,这似乎是一个简单的游戏-老实说,是的。 这不像我们在玩扑克星际争霸 。 但是,每个玩家在游戏过程中的任何时候仍然可以进行大量的动作。

In puzzles like Sudoku, there’s an “answer” which we want to solve for. But there is no answer when it comes to strategy games.

在数独之类的难题中,有一个我们要解决的“答案”。 但是,关于策略游戏,没有答案。

We’re playing against another opponent — like a person, computer, or a cat detective. This requires strategy and some thought into how the game may turn out as it rolls along.

我们正在与另一个对手(例如人,计算机或猫侦探)竞争。 这需要策略和对游戏进行过程的思考。

Such games can evolve and produce an absurd amount of possible outcomes. So we need to think of how we can choose the best possible move, without spending the amount of time it took for cats to populate the Earth.

这样的游戏可以进化并产生大量可能的结果。 因此,我们需要考虑如何选择最佳的移动方式,而不用花费猫在地球上花费的时间

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值