传统游戏与ar游戏的对比
AI has a long history in the genre of games. From the first intelligent Checkers player, to the team AI developed for first-person-shooters, AI is at the core. The upcoming stories will cover aspects of game AI from traditional game playing of Checkers, Chess, Othello, and Go to more recent video games including first-person-shooters, strategy games, and others. We’ll introduce the mini-max algorithm and alpha-beta pruning, which are central to traditional two-player games. We’ll then explore other algorithms that can be found in modern game systems.
人工智能在游戏类型中具有悠久的历史。 从第一个智能Checkers播放器,到为第一人称射击游戏开发的AI团队,AI都是核心。 即将到来的故事将涵盖从跳棋,国际象棋,奥赛罗和Go的传统游戏到游戏AI的各个方面,以及最近的视频游戏,包括第一人称射击游戏,战略游戏等。 我们将介绍mini-max算法和alpha-beta修剪,它们是传统两人游戏的核心。 然后,我们将探索在现代游戏系统中可以找到的其他算法。
两人游戏 (TWO-PLAYER GAMES)
Two-player games are games in which two players compete against each other. These are also known as zero-sum games. The goal then in playing a two-player game is choosing a move that maximizes the score of the player and/or minimizes the score of the competing player.
两人游戏是两个玩家互相竞争的游戏。 这些也称为零和游戏。 然后,在玩两人游戏时,目标是选择使玩家得分最大化和/或使竞争玩家得分最小的举动。
A zero-sum game is one in which the gain of one player is balanced exactly by the loss of the other player. Zero sum games have been studied extensively by John von Neumann and Oskar Morgenstern and then later by John Nash. Chess is an example of a zero-sum game. In contrast, non-zero-sum games are those in which two players attempt to get rewards from a banker by cooperating or betraying the other player. The prisoner’s dilemma is a classic example of a non-zero-sum game. Both zero and non-zero-sum games are types of games within the field of game theory. Game theory has a range of uses from parlor games such as Poker, to the study of economic phenomena from auctions to social networks.
零和游戏是一种游戏,其中一位玩家的收益与另一位玩家的损失正好平衡。 零和游戏已由John von Neumann和Oskar Morgenstern进行了广泛的研究,然后由John Nash进行了广泛的研究。 国际象棋是零和游戏的一个例子。 相反,非零和游戏是指两个玩家试图通过合作或背叛另一位玩家从银行家那里获得奖励的游戏。 囚徒的困境是非零和游戏的典型例子。 零和和非零和博弈都是博弈论领域内的博弈类型。 博弈论的用途广泛,从诸如扑克之类的小游戏到对从拍卖到社交网络的经济现象的研究。
Consider the two-player game Tic-Tac-Toe. Players alternate moves, and as each move is made, the possible moves are constrained (see the partial Tic-Tac-Toe game tree in Figure 1). In this simple game, a move can be selected based on the move leading to a win by traversing all moves that are constrained by this move. Also, by traversing the tree for a given move, we can choose the move that leads to the win in the shallowest depth (minimal number of moves).
考虑两人游戏井字游戏。 玩家交替移动,并且每次移动都会限制可能的移动(请参阅图1中的局部Tic-Tac-Toe游戏树)。 在这个简单的游戏中,可以通过遍历受此移动约束的所有移动来基于导致获胜的移动来选择移动。 同样,通过遍历给定移动的树,我们可以选择导致最浅深度(最小移动数)获胜的移动。
Tic-Tac-Toe is an interesting case because the maximum number of moves is tiny when compared to more complex games such as Checkers or Chess. Tic-Tac-Toe is also open to numerous optimisations. Consider, for example, the first X move in Figure 1. If the board is rotated, only three unique moves are actually possible. Without optimisation, there exist 362,880 nodes within the complete game tree.
井字游戏是一个有趣的案例,因为与棋子或国际象棋等更复杂的游戏相比,最大移动次数很少。 井字游戏也可进行多种优化。 例如,考虑图1中的第一个X动作。如果旋转电路板,则实际上只有三个唯一的动作是可能的。 没有优化,整个游戏树中就存在362,880个节点。
Two-player games are useful as a test-bed for validating competitive algorithms. Also of interest are one-player games (also known as puzzles). Examples of useful one-player games include the n-disk Towers of Hanoi puzzle and the N-puzzle.
两人游戏可以用作验证竞争算法的试验台。 同样令人感兴趣的是单人游戏(也称为拼图)。 有用的单人游戏示例包括N盘河内拼图塔和N拼图。
At each node in the tree (a possible move) a value defining the goodness of the move toward the player winning the game can be provided. So at a given node, the child nodes (possible moves from this state in the game) each have an attribute defining the relative goodness of the move. It’s an easy task then to choose the best move given the current state. But given the alternating nature of two-player games, the next player makes a move that benefits himself (and in zero-sum games, results in a deficit for the alternate player).
在树中的每个节点处(可能的移动),可以提供一个值,该值定义了朝着赢得游戏的玩家的移动的良好性。 因此,在给定节点上,子节点(游戏中从该状态开始的可能移动)均具有定义移动相对优势的属性。 然后,根据当前状态选择最佳移动是一项容易的任务。 但是考虑到两人游戏的交替性质,下一位玩家会采取有利于自己的举动(在零和游戏中,会导致另一位玩家出现亏损)。
A static evaluation function (that measure the goodness of a move) is used to determine the value of a given move from a given game state. The evaluation function identifies the relative value of a successor move from the list of possible moves as a measure of the move quality toward winning the game. Consider the partial game tree in Figure 2.
静态评估函数(用于衡量移动的优劣)用于从给定的游戏状态确定给定移动的值。 评估功能从可能的移动列表中识别出后续移动的相对值,作为衡量移动质量以赢得游戏的标准。 考虑图2中的部分游戏树。
The static evaluation function is defined as the number of possible win positions not blocked by the opponent minus the number of possible win positions (row, column, and diagonal) for the opponent not blocked by the current player:
静态评估功能定义为未被对手阻止的可能获胜位置数量减去未被当前玩家阻止的对手的可能获胜位置数量(行,列和对角线):
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/d3c7550c6d5973f4f4e8fa47aff80894.png)
Tic-Tac-Toe game tree with static evaluation function.
带有静态评估功能的井字游戏树。
f (n) = win_positions-lose_positions (Eq 2)
f(n)= win_positions-lose_positions(等式2)
Using this evaluation function, we identify the goodness of the board configuration given a move for X in Figure 2. The higher the result of the static evaluation function, the closer the move brings the player toward a win. Three moves result in the evaluation function equaling three, but only one move can lead to a win for X as the other two lead to a subsequent win for O. Therefore, while the static evaluation function is useful, another heuristic is necessary to pick the move with the highest static evaluation while protecting against a loss in the next move.
使用此评估功能,我们确定了图2中X动作的棋盘配置的优劣。静态评估功能的结果越高,移动就越使玩家获胜。 三步移动会导致评估函数等于三,但是只有一次移动会导致X获胜,而其他两步则会导致O后续获胜。因此,虽然静态评估函数很有用,但还需要另一种启发式方法来选择以最高的静态评估得出的结果,同时防止下一步骤的损失。
In the coming stories we will look at an algorithm that provides a means to select a move that brings the player closer to a win while moving the opponent further from a win.
在接下来的故事中,我们将介绍一种算法,该算法提供一种选择动作的方法,该方法可使玩家更接近获胜,同时将对手从获胜位置进一步移开。
翻译自: https://medium.com/swlh/game-ai-from-traditional-games-f1bf9cc5a5ae
传统游戏与ar游戏的对比