240 likes | 352 Views
Deriving Concepts and Strategies from Chess Tablebases. Matej Guid, Martin Možina, Aleksander Sadikov, and Ivan Bratko. Faculty of Computer and Information Science University of Ljubljana, Slovenia May 200 9. Advances in Computers and Games (ACG 12 ) Pamplona, Spain, May 11-13, 2009.
E N D
Deriving Concepts and Strategies from Chess Tablebases Matej Guid, Martin Možina, Aleksander Sadikov, and Ivan Bratko Faculty of Computer and Information Science University of Ljubljana, Slovenia May 2009 • Advances in Computers and Games (ACG 12)Pamplona, Spain, May 11-13, 2009
Introduction Chesstablebasescontaina wealth of knowledge, however, mining for this knowledge, manuallyor automatically, proved as extremely difficult. • Machine learning from tablebasesdid not yield much success… • relatively small domains (such as KRK endgame in chess) • resulting models are hardly intelligible to human experts (novices, beginners…) RESEARCH QUESTION How to producehuman-understandable models and use them to generate instructions suitablefor teaching humans?
hierarchical goal-based rules IF ... THEN ... IF ... THEN ... ... ABML textbook instructions games with instructions
Obtaining Knowledge from Domain Expert Computer (to theexpert): “What goal wouldyou suggest for white in this position? What are the reasons for this goal to apply in this position?” Theexpert (a FIDE master): “Black king isquiteclose to theedge of the board, but the king is notconstrained by white pieces. Therefore Iwould suggest White to constrain blackking.“ A new attributeking_constrained was introduced. The argument was used to induce a new rule.
Strategic Goal-Based Rules Hierarchical model of an ordered set of rules of the following form: IF preconditionsTHENgoal Preconditions and goals are both expressed by using the featuresthatresultedfromtheknowledgeelicitationprocess. addedbycomputer IF edist < 3 AND king_constrained = false THEN king_constrained = trueAND edist should not increase inducedfromexpert’s argument preconditions: conjunction of particularconditions goal: conjuctionofparticularsubgoals Theexpertmay add, modify, and/or remove any ofthepreconditionsandsubgoals. It is important to rely on commonknowledgeaboutthedomain!
Strategic Goal-Based Rules Hierarchical model of an ordered set of rules of the following form: IF preconditionsTHENgoal Preconditions and goals are both expressed by using the featuresthatresultedfromtheknowledgeelicitationprocess. addedbycomputer IF edist < 3 AND king_constrained = false THEN king_constrained = trueAND edist should not increase inducedfromexpert’s argument • A subgoalcanspecify: • desired value of an attribute: true/false, <, >, … • itsoptimization: minimize, maximize • qualitative changes: decrease, increase, notdecrease, not increase
Achievability of Goals 7 goal achievable distance to mate F|-- MAX search depth F|-- MIN F|-- F|5 T|6 MAX F|7 • iterative deepening • goal achievable: player MAX can force its execution • desirable: distance to mate decreases at given search depth allowing non-optimal play, but aiming towards final goal: delivering checkmate
Achievability of Goals 7 goal achievable distance to mate ?|? MAX ?|? MIN ?|? search depth ?|? ?|? MAX ?|? T|4 T|7 F|4 T|5 F|6 F|6 • the student can sometimes achieve the goal in several ways • do they all decrease distance to mate?
Achievability of Goals 7 goal achievable distance to mate ?|? MAX ?|? MIN ?|? search depth T|5 T|6 MAX T|8 T|4 F|4 T|7 T|5 F|6 F|6 • the student can sometimes achieve the goal in several ways • do they all decrease distance to mate?
Achievability of Goals 7 goal achievable distance to mate ?|? MAX T|6 MIN T|9 search depth T|5 T|6 MAX T|8 T|4 F|4 T|7 T|5 F|6 F|6 • the student can sometimes achieve the goal in several ways • do they all decrease distance to mate?
Achievability of Goals 7 goal achievable distance to mate T|10 MAX T|6 MIN T|9 search depth T|5 T|6 MAX T|8 T|4 F|4 T|7 T|5 F|6 F|6 • the student can sometimes achieve the goal in several ways • do they all decrease distance to mate?
Achievability of Goals 7 goal achievable distance to mate T|10 MAX T|6 MIN T|9 search depth T|5 T|6 MAX T|8 T|4 F|4 T|7 T|5 F|6 F|6 • goal achievable • dtm decreases • goal achievable • dtm does not decrease
Achievability of Goals 7 goal achievable distance to mate T|10 MAX T|6 MIN T|9 search depth T|5 T|6 MAX T|8 T|4 F|4 T|7 T|5 F|6 F|6 max search depth Counter example: goal can be achieved, but resulting play does NOT decrease distance to mate
Achievability of Goals 7 goal achievable distance to mate T|10 MAX T|6 MIN T|9 search depth T|5 T|6 MAX T|8 T|4 F|4 T|7 T|5 F|6 F|6 max search depth Among counter examples, the position with highest distance to mate is chosen asthe key counter example.
Key counter example Computer (to the expert): “Would you admonish a student if he or she played 1.Rd1-c1 in this position?" 1.Ke7-d7 is optimalmoveaccording to tablebases: achieves mate in 6 moves (after 1...Kb7-b62.Rd1-d5!) 1.Rd1-c1 is theworstpossibleexecutionofsuggestedgoal (“constrainking…”) achieves mate in 11 moves -> muchworse!
Key counter example Computer (to the expert): “Would you admonish a student if he or she played 1.Rd1-c1 in this position?" Human players typically choose a longer path to win by systematically achieving intermediate goals. The resulting play in counter examples should lead to overall progress towards achieving the final goal of delivering checkmate.
Key counter example Computer (to the expert): “Would you admonish a student if he or she played 1.Rd1-c1 in this position?" The expert found this execution of the goalto be perfectly acceptable. The rule IF edist < 3 AND king constrained = false THEN king constrained = true AND edist should not increase was therefore accepted.
Hierarchy of Goals • the student is instructed to always try to execute thehighest achievable goal • goal is achievable also when goals can be executedregardless of the defender's play (optimal or non-optimal) • typical of a human way of thinking It would be redundant to express goals in the followingway: “Constrainblackkingor deliver a checkmate, if the opponent plays badly and allows it."
Constructing Human-Friendly Instructions • instructions are obtained by statingonly the progressive subgoal • IF king_constrained = false … THEN king constrained = true … • IF … THEN edist should decrease • IF edist>0 … THEN edist=0 • the exception is the last, default goal IF edist < 1 THEN edist should not increase AND knight_on_edge = false AND wrong_corner_wayshould decrease AND wrong_corner_way minimize AND white_king_more_central = true derivedinstruction: “Block the way to the wrong corner."
Obtaining Diagrams and Variations • desirable to provide most useful representation of the goals and concepts • simulations of delivering checkmate • randomly chosen initial positions • the program used hierarchy of goals as a heuristic • execution of goals in these simulations was optimal (quickest play) Foreachgoal… Position that occurred mostfrequentlyis presented by a diagram. Whenseveral positions occurred equally frequently, more diagrams were used andvariation (sequenceofmoves) given.
The Bishop and Knight Checkmate (KBNK) • regarded as the most difficult ofthe elementary mates • general strategy: • driving the opposing king to the edge of the board • forcing the king to theappropriate corner • delivering a checkmate • only knowing thisbasic strategy hardly suffices for delivering checkmate For example, grandmaster Epishin (Kempinski-Epishin, Bundesliga 2001) failed toforce the defending king to the appropriate corner and the game ended in a draw. No formalizedmodelsfor KBNK endgamesuitable for teaching purposes were derived by any machine-learning programs.
Derived Strategy, Concepts, and Example Games A strategy is an ordered list of goals: (highest) goal: Deliver checkmate. goal: Prepare the knight for checkmate. goal: Restrain black to a minimal area beside the right corner. goal: Build a barrier and squeeze black king's area. goal: Approach black from the center. goal: Block the way to the wrong corner. goal: Push black towards the right corner. goal: Push black towards the edge. goal: Approach with the king. goal: Bring the knight closer to black king. default goal: Keep the kings close. The rule-based model for KBNK, description of the attributes and example games containing automatically generated instructions can be found in a web appendix athttp://www.ailab.si/matej/KBNK/
Evaluation • Threechessteachers (among them a selectors of Slovenian women'sandyouth squad) all agreed on the usefulness of the presented concepts and found thederived strategy suitable for educational purposes. • Among the reasons to supportthis assessment was that the instructions “clearly demonstrate the intermediatesubgoalsofdeliveringcheckmate.” • The rules by using them as a heuristic function for 6-plyminimax search to play 100 randomly chosen KBNK positions (at least 28 moves to mate with optimal play) against perfect defender: • quickestplay: average game length was 32 moves, 100% checkmate • slowestplay: average game length was 38 moves, 100% checkmate • Four strong grandmasters were asked to express their assessment for each game to what degree (1 to 10) they findKRK play to be human-like:
Conclusions • We developed a procedure • for semi-automatic synthesis of textbook instructionsfor teaching thedifficultKBNK endgame, • accompanied by example games containinggenerated instructions. • Derived strategy includesconceptsand key positionsfrom KBNK that helpthe human learner to easily understand main principles of this strategy: • detected automatically from simulated games • goals enable correct play also against sub-optimal defence • Positive assessment of derived textbook instructions by chesscoaches • We explained: • guidelines for interaction between the machine and the expert to obtain a human-understandable rule-based model for playing a chess endgame • how the instructions, including illustrative diagrams, could be derived semi-automatically from such a model.