Improving Strategic Decisions in Sequential Games by Exploiting Positional Similarity
1. Introduction
At the beginning of the twentieth century, Zermelo proved a proposition which can be interpreted: “chess is a trivial game”.
Rubinstein continues:
But [in games like chess] this calculation requires going through a huge number of steps, something no human being can accomplish. Modeling games with limited foresight remains a great challenge [and the frameworks studied thus far] fall short of capturing the spirit of limitedforesight reasoning.
We cannot stress enough how bounded rationality is not just a “human” feature. Any decisionmaking agent operating in large extensive games, including supercomputers, needs to resort to heuristic assessments to make decisions. Artificial Intelligence can then provide us with stylised and testable models of boundedly rational decisionmaking, which we can use to support human decisionmaking as well—a point of view which we take in this paper.
The approach we take in this paper is to formulate a generalised notion of similarity between game states to improve the performance of gameplaying agents by smart search: if a trap was found after position x and we now analyse position y, which is very similar to x, then chances are we still have a trap after y. As similar strategies are likely to contain similar move sequences but not necessarily similar board positions, our measures are based on possible moves from each position, rather than the appearance of the board itself.
Our Contribution. We study the similarities of game positions in twoplayer, deterministic games of perfect information, looking at the structure of their local game trees, working with the set of possible moves from each position. We introduce novel similarity measures based on the intersection of move sets, and a structural similarity measure that only considers the arrangement of the local game tree and not the specific moves entailed. We analyse the formal relation of these measures and test them against benchmark problems in chess, with a number of surprising and promising findings. Notably, our structural similarity measure was able to match trap states to their childtrap states with 85% accuracy without using domainspecific knowledge. On top of this, we introduce a movematching algorithm, which accurately pairs moves with similar strategic value from different positions. Our results are of immediate relevance to MCTS adaptations to detect and avoid trap states in gameplay.
Paper Structure. The section “Positional Similarities” introduces our formal setup to compare game trees through a number of similarity measures. The section “Detecting Structural Similarities” uses these as the basis of a dynamic algorithm to detect structural similarities among subtrees. In the “Performance” Section, we compare these against known chess positions. We conclude by discussing potential applications and research directions.
2. Positional Similarities
We now present three natural measures, of increasing complexity, to establish how similar such trees are: the similarity of continuations, the similarity of sequences, and the treeedit similarity. All these measures are model free, in the sense that they can be used in all situations that can be described as twoplayer finite extensive games of perfect information. We analyse their formal interrelation in this section and use them as the basis of our dynamic algorithm in the subsequent one.
2.1. Similarity of Continuations
$${P}_{cont}$$
As ${M}_{1}^{d},{M}_{2}^{d}$ can be found from a simple expansion of the game trees, computing such a measure takes time $$
, where b is the breadth of the game tree.
At depth 1, the similarity of continuations simply calculates the proportion of children that two nodes share. When extended to a deeper search, the measure becomes less finegrained, since a move that occurs at different depths in the trees will still count as shared, and multiple occurrences of the same move are only counted once.
, ${M}_{2}^{2}=$
.
$${P}_{cont}$$
2.2. Similarity of Sequences
Our second similarity measure, which we call similarity of sequences, uses longer sequences of moves rather than single plies. To ease computation, we require each possible move sequence of length d from tree root ${T}_{1}$ to first be rewritten according to a predetermined move, ordered as a simplified sequenceS. Formally, two sequences are simplified into one if—and only if—they are the same modulo move permutation. These simplified sequences are then stored in a structure ${T}_{1}^{\prime}$, which we call the simplified tree of ${T}_{1}$. As different move permutations can create the same simplified sequence, we also store the multiplicityk of each S in ${T}_{1}^{\prime}$, where k corresponds to the number of ways S can be reached from the root note. Then, the similarity of sequences calculates the ratio of the intersection to the union of the simplified trees.
$${P}_{seq}$$
$${T}_{1}^{\prime}=$$
$${T}_{2}^{\prime}=$$
where the superscript corresponds to the multiplicity of each sequence. Then
$${P}_{seq}$$
The tree simplification can be performed in one depthfirst pass of each tree, taking time $\mathcal{O}\left({b}^{d}\right)$. Calculating the proportion of shared sequences takes $\mathcal{O}\left(\right{T}_{1}^{\prime}+{T}_{2}^{\prime}\left\right)$, which is equal to $\mathcal{O}\left({b}^{d}\right)$ in the worst case, the same logarithmic complexity as the similarity of continuations. It should be noted that the treereduction step means that the complexity coefficient is larger for the similarityofsequences calculation. This is a tradeoff for accuracy at depth $d>1$, as less information is lost when calculating from sequences rather than continuations.
, for depth d, ${n}_{i}$ nodes and ${m}_{i}$ edges in trees ${T}_{1}$, ${T}_{2}$. The similarity of sequences is also comparable to the random walks kernel [20], a measure of similarity between two graphs found by counting the number of random paths they share. The main difference here is that the similarity of sequences has limited depth and is a normalised metric.
2.3. TreeEdit Similarity
$$\frac{2e({T}_{1},{T}_{2})}{}$$
where $e({T}_{1},{T}_{2})$ is the treeedit distance between ${T}_{1}$ and ${T}_{2}$, and $\alpha $ is the weight of edit operations. Since there is no need to weigh edit operations differently, we may take $\alpha $ to be one for all operations. Then, as shown by Li and Zhang [21], the formula is valid as a metric. Since calculating the distance between two trees is equivalent to calculating their similarity and subtracting it from one, we define the treeedit similarity as
$${P}_{tree}$$
$${P}_{tree}$$
2.4. Comparing Terminal States
It may sometimes be necessary to find the similarity of two terminal states. In terms of the game tree for a zerosum game, two terminal nodes should have a value of one if they give the same reward for the agent (win–win, draw–draw, lose–lose), and zero if the reward is different. Since two terminal nodes have no children, their fractional similarity measure is undefined, so we must handle this case separately.
$$P$$
This can be used in endgame cases to prevent zero errors when calculating other similarity measures.
2.5. Relationship between Measures
At depth 1, the similarity of sequences and the similarity of continuations are equivalent, as each child move only appears once per tree. At depth 2, the similarity of sequences has greater variation, as can be seen from the following chessinspired instance.
$${P}_{cont}$$
$${P}_{cont}$$
$${P}_{cont}$$
$${P}_{cont}$$
and thus, the similarity of sequences has greater variation than the similarity of continuations. The treeedit similarity is yet more variable than the similarity of sequences, as can be seen from further calculations on the same examples.
$${P}_{tree}$$
$${P}_{tree}$$
Modulo is the tradeoff between simplicity and complexity. The above similarity measures can be used to analyse any game trees with consistent move labelling. This might be especially useful for games with less dynamic trees; that is, those without capturing or blocking moves that change the game tree structurally between plies. For games such as Go, with the potential to use one piece to exert power over a whole area, these measures provide useful tools for analysis, which can be further explored by accounting for symmetries and abstractions of the board.
3. Detecting Structural Similarities
We may find ourselves comparing positions that do not share several continuations, e.g., those that are far away from one another in a game tree. What we can then do is to extend the previous approach to recursively check for subtree similarity.
Structural Similarity Measure
$$S$$
Algorithm 1 Structural Similarity Detection Protocol. 

$$P$$
$$P$$
$$\{$$
$$\{$$
and their total distance is 0.683. So
$$S$$
While the structural similarity measure may calculate more accurate similarities between positions, this comes at a cost, as each calculation requires similarity computations of every child node to its parent. When the similarity of sequences or continuations at depth 1 is used as the base measure, on average it takes time $\mathcal{O}\left({b}^{2}\right)$ to calculate the similarity of all children to their parent. Assigning children in pairs using the Hungarian algorithm takes $\mathcal{O}\left({b}^{3}\right)$ operations, so the structural similarity algorithm runs in time $\mathcal{O}\left({b}^{3}\right)$. To improve the complexity, the measure can be approximated by randomly sampling child nodes and calculating their structural similarity, which warrants further investigation.
Move Matching. As the structural similarity measure pairs moves that are comparably similar to their parent states, this method can be used to pair moves from different board positions that may have similar strategic value. For example, if one position is known to have a killer move in two plies, leading to a win for the opponent, and this position has a high similarity to a new position, the depth 2 matches can be inspected and the move that is most frequently matched to the killer move in the known position can be identified, and this move is likely to be a killer move from the new position. We will evaluate the effectiveness of this approach in the forthcoming section.
Generalisability. The structural similarity measure is generalisable to the analysis of any two local trees with selfconsistent move labellings, as the measure can be calculated independently of such labels. This means, e.g., that the structure of a local Go tree can be compared to that of a local chess tree or, alternatively, we can show how a game tree changes through the game.
Calculating how dynamic a game is, in terms of the variability of the connection density of the graph, can be very useful in indicating which gameplay heuristics to use. For example, to use the AllMovesAsFirst (AMAF) heuristic, which initially updates sibling nodes with the same estimated value for each move played, an agent first assumes that a move from one node is likely to affect the game in a similar way to the same move played from a sibling node. This may be likely to work on less dynamic games, but can be less reliable for highly dynamic games, where the effect of a move on the state of the game is less consistent. Conversely, pruning may be most helpful for highly dynamic games, as these games offer a stark contrast between reward values for different branches, which is not necessarily the case for less dynamic games.
4. Performance
In general, there was no significant difference between the proportion of false positives (nontraps with above average similarity) and false negatives (traps with below average similarity) given by the similarity of sequences, similarity of continuations and treeedit similarity. However, the added time complexity of the similarity of sequences and treeedit similarity at depth 2 was significant. Thus, perhaps surprisingly, the similarity of continuations is effectively better as a heuristic similarity measure for evaluating similarities of closely related board positions than the similarity of sequences.
Finally, for complexity considerations, we tested the structural similarity measure on five smaller samples of 40 randomly selected child positions from the first two trap positions. Using this measure, an average of 85% of child trap states had above average structural similarity to the original position. The high complexity of this measure makes it time intensive to compute, but results clearly show it is rather effective at picking out potential trap states from a select sample of positions.
Move Matching. The movematching algorithm was also tested on various chess positions to detect moves with similar strategic impact. Frequent matchings were assumed to be a more reliable indicator of moves with a similar effect on gameplay, so only the top five most frequently matched pairings were assessed.
These results show that the movematching algorithm is fairly well suited to finding similarly decisive moves from different board positions, and thus is useful for detecting possible trap states and sacrificial moves from the gametree structure without evaluating board positions.
Disasters Expo USA, is proud to be supported by Inergency for their next upcoming edition on March 6th & 7th 2024!
The leading event mitigating the world’s most costly disasters is returning to the Miami Beach
So don’t miss out and register today: https://shorturl.at/aikrW
And in case you missed it, here is our ultimate road trip playlist is the perfect mix of podcasts, and hidden gems that will keep you energized for the entire journey
