hex combinatorial search in game strategy by brandon risberg may 2006menlo school
TRANSCRIPT
![Page 1: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/1.jpg)
Hex
Combinatorial Search in Game Strategy
by
Brandon Risberg
May 2006Menlo School
![Page 2: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/2.jpg)
Background
• Where I got the idea:• I first got the idea for “Hex” when we played it
during an Algebra 2 class period with Mr. Squilante.
• I got the idea to make an artificial intelligence for the game when I went to see the “Mastering the Game” exhibit about computer chess at the Computer History Museum.
![Page 3: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/3.jpg)
Introduction
• “Hex” is a board game defined by the mathematician Piet Hein
• It is a two player game played on a diagonal board.
![Page 4: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/4.jpg)
Rules
• Both players trade off claiming “hexes” on the game board.
• The goal is to create a chain of hexes from your side to your other side.
![Page 5: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/5.jpg)
Java Game Programming
• Used nested “Swing” components and graphics.
• Imported image files created in Photoshop.
• Used multiple threads to handle animation.
• Implemented a recursive method to detect a winning chain.
• Added help files and windows for ease of use.
• Created an opening splash dialog.
![Page 6: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/6.jpg)
A.I. Algorithms
• Mini-Max• Generate a move tree.
• Evaluate each position in tree.
• Select best move at each level:• Minimize score on opponent move.
• Maximize score on own move.
![Page 7: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/7.jpg)
Example Search Tree
![Page 8: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/8.jpg)
A.I. Algorithms (con’t)
• Alpha – Beta pruning• Pruning branches of the search tree that will
yield less favorable results.
• Improves search speed; does not improve quality of moves.
• Heuristics or “Rules of Thumb”• Guidelines that will help constrain the search.
![Page 9: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/9.jpg)
Examples of Heuristics
• In real life:• Menlo registrar must assign students to class
sections.• This is a complex search problem.• Heuristic: make the critical assignments first.
• Senior English sections (workshops) cannot be interchanged, so begin with these.
• Freshman English classes are interchangeable so do these last.
![Page 10: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/10.jpg)
Examples of Heuristics
• In board games:• In chess, keeping your pieces in the center will
usually be a stronger position.• “A knight on the rim is dim”
• In Hex, a longer chain of connected hexes will usually be a stronger position.
• This logic is typically built into the static evaluator.
![Page 11: Hex Combinatorial Search in Game Strategy by Brandon Risberg May 2006Menlo School](https://reader035.vdocuments.net/reader035/viewer/2022072011/56649e0e5503460f94af7cc7/html5/thumbnails/11.jpg)
Care to try a game?