The Game of Hex A Domain Specific Search Technique For A Beautiful Game Stefan Kiefer.

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

Alpha-Beta Search. 2 Two-player games The object of a search is to find a path from the starting position to a goal position In a puzzle-type problem,
How to Schedule a Cascade in an Arbitrary Graph F. Chierchetti, J. Kleinberg, A. Panconesi February 2012 Presented by Emrah Cem 7301 – Advances in Social.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Prepared by Doron Shahar
Domineering Solving Large Combinatorial Search Spaces.
Circuit Analysis III Section 06.
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
Games with Chance Other Search Algorithms CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 3 Adapted from slides of Yoonsuck Choe.
Game Playing CSC361 AI CSC361: Game Playing.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
Hex A game of connections. The Beginning Invented independently by Piet Hein in 1942 and John Nash in Invented independently by Piet Hein in 1942.
MAE 552 – Heuristic Optimization Lecture 28 April 5, 2002 Topic:Chess Programs Utilizing Tree Searches.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
II–2 DC Circuits I Theory & Examples.
1 Game Playing Chapter 6 (supplement) Various deterministic board games Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s.
1 Solving Ponnuki-Go on Small Board Paper: Solving Ponnuki-Go on small board Authors: Erik van der Werf, Jos Uiterwijk, Jaap van den Herik Presented by:
Monte Carlo Go Has a Way to Go Haruhiro Yoshimoto (*1) Kazuki Yoshizoe (*1) Tomoyuki Kaneko (*1) Akihiro Kishimoto (*2) Kenjiro Taura (*1) (*1)University.
THE RENJU GAME BY ABHISHEK JAIN, PRANSHU GUPTA & RHYTHM DAS PCLUB SUMMER PROJECT PRESENTATION JUNE, L7 IIT KANPUR MENTOR – SANIL JAIN.
Alpha-Beta Search. 2 Two-player games The object of a search is to find a path from the starting position to a goal position In a puzzle-type problem,
Chapter 5.4 Artificial Intelligence: Pathfinding.
Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
The Node Voltage Method
Chapter 5.4 Artificial Intelligence: Pathfinding.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Othello Artificial Intelligence With Machine Learning
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
Do you drive? Have you thought about how the route plan is created for you in the GPS system? How would you implement a cross-and- nought computer program?
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Agents that can play multi-player games. Recall: Single-player, fully-observable, deterministic game agents An agent that plays Peg Solitaire involves.
1 ECE-517 Reinforcement Learning in Artificial Intelligence Lecture 7: Finite Horizon MDPs, Dynamic Programming Dr. Itamar Arel College of Engineering.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Mathematical Induction I Lecture 4: Sep 16. This Lecture Last time we have discussed different proof techniques. This time we will focus on probably the.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Chess and AI Group Members Abhishek Sugandhi Sanjeet Khaitan Gautam Solanki
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
CS 682, AI:Case-Based Reasoning, Prof. Cindy Marling1 Chapter 8: Organizational Structures and Retrieval Algorithms This chapter deals with how to find.
GAME PLAYING 1. There were two reasons that games appeared to be a good domain in which to explore machine intelligence: 1.They provide a structured task.
COSC 2007 Data Structures II Chapter 13 Advanced Implementation of Tables IV.
Solving Kriegspiel endings with brute force: the case of KR vs. K Paolo Ciancarini Gian Piero Favini University of Bologna.
Today’s Topics Playing Deterministic (no Dice, etc) Games –Mini-max –  -  pruning –ML and games? 1997: Computer Chess Player (IBM’s Deep Blue) Beat Human.
Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.
Game tree search Thanks to Andrew Moore and Faheim Bacchus for slides!
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
The Standard Genetic Algorithm Start with a “population” of “individuals” Rank these individuals according to their “fitness” Select pairs of individuals.
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
Section Objectives  Describe how current divides in a parallel circuit.  Determine the voltage across and current through each branch of a parallel.
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
David Kauchak CS52 – Spring 2016
Games with Chance Other Search Algorithms
Alpha-Beta Search.
Alpha-Beta Search.
Instructor: Vincent Conitzer
The Alpha-Beta Procedure
Alpha-Beta Search.
Alpha-Beta Search.
Alpha-Beta Search.
CS51A David Kauchak Spring 2019
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

The Game of Hex A Domain Specific Search Technique For A Beautiful Game Stefan Kiefer

This Talk presents the game of Hex and a (search) method for Hex-playing computer programs presents the game of Hex and a (search) method for Hex-playing computer programs is mainly based on the information of the following paper: is mainly based on the information of the following paper: –V. V. Anshelevich. A Hierarchical Approach to Computer Hex. Artificial Intelligence, 134, 2002, pp wants to explain: wants to explain: –the rules of Hex –the key concept of virtual connections –applications of virtual connections

The Beginning Invented independently by Piet Hein in 1942 and John Nash in Invented independently by Piet Hein in 1942 and John Nash in Played on a grid of hexagons. A standard size is 11x11. Also common: 10x10, 14x14, 19x19. Played on a grid of hexagons. A standard size is 11x11. Also common: 10x10, 14x14, 19x19. Object of the game is to make a continuous chain of your color to connect your sides of the board. Object of the game is to make a continuous chain of your color to connect your sides of the board. Simple Rules Simple Rules –Play anywhere: Very wide game tree Nice properties: Nice properties: –First Player Win (easy proof) –No Ties (intuitively easy) Unfortunately: not widely played by humans, not yet ;-) but you can play at Unfortunately: not widely played by humans, not yet ;-) but you can play at

The Board

The Challenge Write a program that plays Hex! Write a program that plays Hex! Difficult: Difficult: –The board is large: Every empty cell is a legal move.  The game tree is wide: b =~ 80 between chess (b =~ 35) and go (b =~ 250)  Massive Alpha-Beta-Search doesn’t work well. –Determining the winner (assuming perfect play) in an arbitrary Hex position is PSPACE-complete [Rei81]. How to get knowledge about the “potential” of a given position without massive game-tree search? How to get knowledge about the “potential” of a given position without massive game-tree search?

The Challenge (cont‘d) Who can win (assuming perfect play)? Who can win (assuming perfect play)? –I don’t know. –And: We have no efficient algorithm to figure it out! Given this position: Given this position:

Virtual Connections: Two-Bridges a tactical element: “two- bridges” Blue can connect the blue cells: even if red moves first! even if red moves first! no matter what red does! no matter what red does! This is called a Virtual Connection between the blue cells.

Virtual Connections: Two-Bridges

Virtual Connections: The AND-rule Virtual connections can be combined to larger virtual connections. Virtual connections can be combined to larger virtual connections. The AND-rule: two virtual connections with a common occupied end together form a larger virtual connection. The AND-rule: two virtual connections with a common occupied end together form a larger virtual connection. The “carriers” A and B have to be disjoint. The “carriers” A and B have to be disjoint. A B

Virtual Connections: Edge Templates from the 3rd Row u x v y x-u and u-y are virtually connected (by two-bridges). x-u and u-y are virtually connected (by two-bridges). u is not occupied. u is not occupied. But, if Blue moves first, (s)he can establish a virtual connection by playing on u. But, if Blue moves first, (s)he can establish a virtual connection by playing on u. The situation in the red oval is called a Virtual Semi- Connection between x and y. The situation in the red oval is called a Virtual Semi- Connection between x and y. A B

Virtual Connections: Virtual Semi- Connections and the OR-Rule u xv y Due to the same reason, there is also a virtual semi- connection between x and y via v. Due to the same reason, there is also a virtual semi- connection between x and y via v. Because the intersection of the carriers of both virtual semi-connections is empty, we can combine them to a full virtual connection! Because the intersection of the carriers of both virtual semi-connections is empty, we can combine them to a full virtual connection!

The OR-rule wrapped up 1. Build virtual semi-connections: 2. Combine them to a virtual connection:

Also the two-bridges can be derived using the OR-rule: x and y are virtually semi- connected via u. x and y are virtually semi- connected via u. x and y are also virtually semi- connected via v. x and y are also virtually semi- connected via v. Application of the OR-rule yields a virtual connection between x and y using {u,v} as the carrier.  the well-known two-bridge! Application of the OR-rule yields a virtual connection between x and y using {u,v} as the carrier.  the well-known two-bridge! Virtual Connections: Virtual Semi- Connections and the OR-rule x y u v

Straight-forward Calculation of Virtual Connections VC := neighboring cells; // these are trivial virtual connections // with empty carriers: “first generation” Repeat apply AND/OR-rules to VC and add the new virtual connections to VC Until no new virtual connections are found; Return VC

Straight-forward Calculation of Virtual Connections (cont’d) This procedure combines – generation by generation – existing virtual connections to larger ones. This procedure combines – generation by generation – existing virtual connections to larger ones. Thus, a hierarchy of virtual connections is defined. Thus, a hierarchy of virtual connections is defined. Large virtual connections can provide information about the potential of Hex positions far ahead. Large virtual connections can provide information about the potential of Hex positions far ahead.

Examples for Virtual Connections found by the Algorithm: 4th row

Examples for Virtual Connections found by the Algorithm: a Ladder x y

Examples for Virtual Connections found by the Algorithm: a Win

Examples for Virtual Connections found by the Algorithm: an early Win

Applications of Virtual Connections 1. Proving a win for a player (as seen on the previous two slides) 2. Limiting the search tree (see next slide) 3. Building a good evaluation function (see later)

Limiting the search tree If Red sees the virtual semi- connection between the two blue sides, then (s)he has to play there. If Red sees the virtual semi- connection between the two blue sides, then (s)he has to play there. Otherwise, Blue plays on the cyan cell and turns the virtual semi-connection into a virtual connection and wins! Otherwise, Blue plays on the cyan cell and turns the virtual semi-connection into a virtual connection and wins!

An Evaluation Function Idea: As in virtual connections, look at the board from one player’s (e.g. Blue’s) perspective. As in virtual connections, look at the board from one player’s (e.g. Blue’s) perspective. Put wires and resistors (yes, electrical ones) in the board and apply a voltage between the blue sides. Put wires and resistors (yes, electrical ones) in the board and apply a voltage between the blue sides. The higher the current, the better the position for Blue! A shortcut means win! The higher the current, the better the position for Blue! A shortcut means win!

An Evaluation Function (cont’d)

Do for both players: Do for both players: –Put in the wires, resistors and apply the voltage. –Calculate the total current using Kirchhoff’s laws (linear equation system). Compare the “blue” and the “red” circuit: Compare the “blue” and the “red” circuit: –e.g. by dividing the currents: I(blue)/I(red). –Then: A high value (>1) means an advantage for Blue. A high value (>1) means an advantage for Blue. A low value (<1) means an advantage for Red. A low value (<1) means an advantage for Red.

An Evaluation Function: Enhanced with Virtual Connections How to include virtual connections in the circuits? How to include virtual connections in the circuits? Very natural: Put additional links (with a small positive resistance) between virtually connected cells. Very natural: Put additional links (with a small positive resistance) between virtually connected cells. Thus, the current between virtually connected cells is increased Thus, the current between virtually connected cells is increased –reflecting the fact that they can be actually connected in the future.

An Evaluation Function: Enhanced with Virtual Connections (cont’d)

It turns out: A far-sighted evaluation function can be created in this way. It turns out: A far-sighted evaluation function can be created in this way. A shallow game-tree search (alpha- beta) is then sufficient. A shallow game-tree search (alpha- beta) is then sufficient. Modern Hex-playing programs (like Hexy) spend most of their time in the detection of virtual connections in order to enhance the evaluation function. Modern Hex-playing programs (like Hexy) spend most of their time in the detection of virtual connections in order to enhance the evaluation function.

Results: The Performance The program “Hexy” (by Anshelevich himself) was the first to employ the presented ideas. The program “Hexy” (by Anshelevich himself) was the first to employ the presented ideas. It won the computer olympiad tournament in It won the computer olympiad tournament in According to its author, Hexy doesn’t reach the playing strength of the best human players. He played with Hexy at According to its author, Hexy doesn’t reach the playing strength of the best human players. He played with Hexy at Recently, the open source program “Six” was developed, based on the same ideas. It won the computer olympiad 2003 last week. Hexy didn’t take part. Recently, the open source program “Six” was developed, based on the same ideas. It won the computer olympiad 2003 last week. Hexy didn’t take part.

References V. V. Anshelevich. A Hierarchical Approach to Computer Hex. Artificial Intelligence, 134, 2002, pp V. V. Anshelevich. A Hierarchical Approach to Computer Hex. Artificial Intelligence, 134, 2002, pp Hexy: Hexy: Six: Six: More Hex-links: More Hex-links: [Rei81] Stefan [Rei81] Stefan Reisch: Hex ist PSPACE- vollständig. Acta Informatica 15, 1981, pp

Incompleteness of the AND/OR- rules Can all virtual connections be detected by the presented algorithm using the AND/OR-rules? Can all virtual connections be detected by the presented algorithm using the AND/OR-rules? Answer: No: Answer: No:

How much time does our algorithm for virtual connections take? We know: We know: –Determining the winner of an arbitrary Hex position is PSPACE-complete. –The AND/OR-rules are incomplete, i.e., they don’t discover all virtual connections. So, maybe our algorithm (using only AND/OR-rules) can be implemented efficiently? So, maybe our algorithm (using only AND/OR-rules) can be implemented efficiently? Answer: No: The algorithm solves a PSPACE-complete problem as well. Answer: No: The algorithm solves a PSPACE-complete problem as well.

Virtual Connections: Are they still useful? The previous two slides showed disadvantages of virtual connections and the AND/OR-rules. What does that tell us? The previous two slides showed disadvantages of virtual connections and the AND/OR-rules. What does that tell us? Well, these were theoretical results, not always meaningful to the practice… Well, these were theoretical results, not always meaningful to the practice… The calculation of virtual connections has already been proven to be useful in practice. The calculation of virtual connections has already been proven to be useful in practice. Since it is computationally expensive, good heuristics need to be developed: Since it is computationally expensive, good heuristics need to be developed: –Which computed virtual connections should be combined (by which rules)? –When to stop with the search for virtual connections? This is a research challenge for the future. This is a research challenge for the future.