First, the basic concept
Game classification: Single player Game (Huarong), double game (chess, go), multiplayer game (Mahjong, bridge), complete information game (chess, go), incomplete information game (Mahjong, Bridge, Three Kingdoms kill, etc.).
Note: Freshman has elective a course: Game theory, also in the number of modules have done some game research, there are some foundation, so the game in the machine game concept is easy to understand. But the game theory (game theory) is an important branch of economics (although I found that the books on game theory in our school library are mainly in the mathematical bookshelf, this is also a reason), the main research is the social dilemma (such as the classic Prisoner dilemma), is usually a non-zero-sum game (that is, committed to the success of the situation), and the machine game (represented by chess) mainly study zero-sum game (that is, the game participants on the other side of the profit will inevitably suffer losses, such as all the chess to win the other side for the purpose). The game of economics is not to be described here.
Second, the data structure in the machine game
The specific knowledge of the data structure is not to be mentioned here, if there is no such knowledge is not necessary to look down. This semester just finished the data structure, some students think is very boring theory, in fact, this boring and interesting between the wicked is so a little exploration of spirit and self-learning consciousness, if ai Gobang------------ is a very basic array. In the case of chess, you can use an array to store the chessboard and check the legitimacy with a Boolean matrix.
Sorting and finding are also frequently used in machine games, as the score of each strategy is filtered to find the optimal strategy.
The idea of recursion and backtracking is equally important.
In the memory of the diagram involved, the adjacency table is the most widely used.
Third, The moves
The move is a pawn moving from one position to another (chess) or a piece of chess that is not on the board to a location on the board (Gobang, Weiqi). The problem that the machine game should solve directly is how to make the best moves. The most basic requirements of the law are in line with the rules of the game, such as horse walking day, like flying field, limp son can not walk, like the eye block can not walk and so on.
Four, Game tree
This year Li Shishi and Alphago's man-machine wars have turned the Monte-Carlo tree Search from an advanced professional vocabulary into a right ingredients technology hot word. The more branches of game tree, the higher the requirement of this kind of game to program design, because it is exponential growth, so unless np=p, the game tree storage and search is always a difficult problem, it is also the key factor of the game level of the machine.
Five, evaluation function
The evaluation function is a scoring mechanism, and by evaluating the function, the winning array used in the connection shown above is a simple evaluation function, the evaluation function is the basis of the law, and the rationality of the evaluation function affects the game level to a great extent. I suspect that the most important part of machine learning is to repeatedly adjust the evaluation function to the best state by repeating the game. In addition, professional chess players are certainly better suited to design evaluation functions than program writers, because their experience is precisely the purpose of machine learning. In addition, the heuristic algorithm (simulated annealing algorithm, genetic algorithm) has been widely used in machine game, I used the simulated annealing algorithm to write the shortest path program 021 simulated annealing algorithm Learning (a)-----to solve the shortest connected path , Indeed, this heuristic algorithm can effectively avoid the problem of local optimal solution of the inefficient and mountain climbing algorithm (a greedy strategy) of global search.
Vi. Basic Search methods
After the game tree is produced, the search game tree obtains an optimal solution, the commonly used search strategy has DFS and BFS, but the whole game tree of Dfs search is obviously unrealistic, so it will be considered to set depth, but too shallow will affect the game level, and the depth will affect the time efficiency. Similarly, heuristic search is also a good choice, such as maximal minimum method, Alpha-beta pruning, negative maximal value search.
Seven, game programming
Language selection, object-oriented language has obvious advantages in designing large programs. The interface should be beautiful, easy to use and interactive. Logical structure should be clear, function should be complete, including basic settings, search policy settings, Undo, Replay, save and other basic functions.
The data structure and basic method in machine game (i.)-----SUMMARY