15
IWEC2002 1 Threat Stacks to Guide Pruning and Search Ext ensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

Embed Size (px)

Citation preview

Page 1: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 1

Threat Stacks to Guide Pruning and Search Extensions in Shogi

Reijer Grimbergen

Department of Information Science

Saga University, Japan

Page 2: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 2

Presentation OverviewThe problem of time constraints

Pruning, search extensions and the horizon effect

Pruning and extensions in shogiThreat stacks

Using threat stacks for search extensionsUsing threat stacks for pruningDealing with horizon moves

Preliminary resultsConclusions and future work

Page 3: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 3

How to deal with premature termination of the search?

Iterative deepening Ensures that there is a completed search to a certain nominal search depth

Search extensions Needed to get a reliable result at each iterationExamples: Quiescence search, Singular extensions

PruningUsed to speed up the search and free time for search extensionsExamples: Futility pruning, ProbCut

The Problem of Time Constraints

Horizon problem Push threats over the search horizon

Page 4: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 4

Pruning and Extensions in ShogiShogi and chess

Shogi is a two-player complete information game similar to chess

Differences with chessDrop rule

Promotion rule

Page 5: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 5

Pruning and Extensions in ShogiExtensions in shogi

Evaluation function is a combination of material and king danger

Need to check both captures and king attack for a position to be quiescent

Extended promotion possibilities lead to a sudden change in evaluation value more often

Problem in shogi The set of non-quiescent positions

is much larger than in chess

Page 6: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 6

Pruning and Extensions in ShogiPruning in shogi

Futility pruning in shogiIt is more difficult to judge inability to recover from a bad position

ProbCut in shogiIt is more difficult to the establish the likelihood that a deep search can be replaced by a shallow search

Page 7: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 7

Pruning and Extensions in ShogiThe horizon problem in shogi

Drop moves make the horizon problem much worse in shogi than in chessIn strong shogi programs threat analysis is used for pruning, extensions and detection of horizon moves

Gekizashi’s probability classificationYSS’s move classificationShotest’s Super-SOMA algorithm

No general framework for the use of threats in the search

Threat Stacks

Page 8: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 8

Threat StacksThe method

Two stacks to store the threats of both playersAfter each move, the threats by each player are pushed on the stacksWhen a move is undone, the threat stacks are popped

Threat entryThreat identification numberUp to three squares for the pieces involved in the threatA value indicating the strength of the threat

Weak threats and strong threatsIgnore weak threats in case of a strong threatDepend on the phase of the game

Page 9: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 9

Threat StacksThreat categories

Check

Threat to gain material

Promotion threat

Discovered attack

Pins

King threats

Page 10: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 10

Threats Stacks and Extensions

Extend the search to empty the threat stacks

Procedurea. Determine the strongest threat by each side

b. If the side to move has a stronger threat than the opponent, execute the threat

c. If the opponent has a stronger threat than the side to move, generate moves to defend against the threat

In case of weak threats, this procedure is only followed in the opening and middle game

Page 11: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 11

Threats Stacks and PruningPruning decisions

Prune sacrifices one move before the nominal search depthPrune if the number of threats is larger than the remaining search depthIn case of a threat, prune moves that neither

• Execute a threat• Resolve a threat• Introduce a threat

Pruning only done in positions with a strong threat

Page 12: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 12

Threats and the Horizon Problem

Horizon moves are dealt with in two steps1. Detect a potential horizon move

2. Analyze threat stacks at the nominal search depth to see if the original threat is still there

This is why threat stacks are used

Page 13: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 13

ResultsTactical shogi problems

Version Total Solved Time used

Threat stacks 298 128 (42%) 02:14:12

Quiescence search 298 97 (33%) 02:34:45

Set of 298 tactical shogi problems from Shukan Shogi30 seconds on a 1.2 GHz Pentium IIIComparison of threat stacks and quiescence search

Page 14: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 14

ResultsMaterial vs. Attack/defense

115 tactical problems involving material

Version Total Solved Time used

Threat stacks 115 93 (81%) 00:50:31

Quiescence search 115 99 (86%) 01:00:45

175 tactical problems involving attack and defense

Version Total Solved Time used

Threat stacks 175 89 (51%) 01:18:27

Quiescence search 175 57 (33%) 01:38:12

Page 15: IWEC20021 Threat Stacks to Guide Pruning and Search Extensions in Shogi Reijer Grimbergen Department of Information Science Saga University, Japan

IWEC2002 15

Conclusions and Future Work

ConclusionsThreat stacks can be used for making decisions about search extensions, pruning and to detect horizon moves

Preliminary results indicate that threat stacks may improve the tactical ability of a shogi program

Future workInvestigate if the tactical improvement results in winning more games

Use threat stacks to guide best first search