Click here to load reader

HPC Checkers

  • View
    103

  • Download
    0

Embed Size (px)

DESCRIPTION

HPC Checkers . By Andy Block Ryan Egan. Table of Contents. Overview of Checkers Overview of Checkers Rules of the Game AI Theory The Program Board Sample Jump Future Moves Parallel Processing Using the Future Table Work in progress. Overview of Checkers. - PowerPoint PPT Presentation

Text of HPC Checkers

HPC Checkers

HPC Checkers ByAndy BlockRyan EganTable of ContentsOverview of CheckersOverview of CheckersRules of the GameAI TheoryThe Program BoardSample JumpFuture MovesParallel ProcessingUsing the Future TableWork in progress

Overview of Checkers8x8 checkered board using only the black squares32 positionsSearch space of 5x1020Each Player starts with 12 men

Rules of CheckersPiecesMen can only move forwarded diagonally 1 spaceKings can move forwarded and backward diagonally 1 spaceUpon reaching the opposite back row men become kingsEach player starts with 12 menJumpingMen and kings are required to jump when possibleMultiple jumps are allowed and required when possibleWhen a man or king is jumped it is removed from the boardIf a man jumps into the back row and becomes a king the turn is ended.

Rules of Checkers cont.Start GameRed always moves firstEnd Game The game ends when one player can no longer moveGame can end it a draw

AI TheoryHeuristicsNot perusing paths that appear to not be as beneficial as other pathsAlpha-beta pruning PlanningFuture moves are calculated to generate a plan of attack that maximizes benefit and minimizes loss. The Program The Board Stored as 33 value integer arrayStarting board{1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,3,3,3,3,3,3,5}Adjacency matrix used to navigate board.The 33rd value in the board array is used for locations that are off the board in the Adjacency matrix.

The Program cont.JumpsFor men jumps form a directed and acyclic graph (DAG)A breadth first search is used to build a list of adjacent jumpable locationsStarting from the last found location the adjacency list is traversed in reverse to find the longest path.This will return the greatest number of possible jumps.Issue: This may miss jumps that would have better outcomes later on.Sample Jump

Enqueue Root (2)2{2Sample Jump

Look Left (9)2{2Sample Jump

Enqueue (9)29{2Sample Jump

Look Right29{2Sample Jump

Look Left (16)29{2,9},Sample Jump

Enqueue (16)2169{2,9},Sample Jump

Look Right (18)2169{2,9},Sample Jump

216189Enqueue (18){2,9},Sample Jump

216189Look Left{2,9},{9,16},Sample Jump

216189Look Right (25){2,9},{9,16},Sample Jump

21618925Enqueue (18){2,9},{9,16},Sample Jump

21618925Look left{2,9},{9,16},{9,18},Sample Jump

21618925Look Right{2,9},{9,16},{9,18},Sample Jump

21618925Look Left{2,9},{9,16},{9,18},{16,25}Sample Jump

21618925Look Right{2,9},{9,16},{9,18},{16,25}Sample Jump

21618925Back to Root{2,9},{9,16},{9,18},{16,25}Sample Jump

21618925Back to Root{2,9},{9,16},{9,18},{16,25}Sample Jump

21618925Back to Root{2,9},{9,16},{9,18},{16,25}Sample Jump

21618925Back to Root{2,9},{9,16},{9,18},{16,25}Sample Jump

21618925Back to Root{2,9},{9,16},{9,18},{16,25}Future MovesFor each move of player 1 each possible move of player 2 is calculatedFor each move of player 2 each possible move of player 1 is calculatedThis is repeated until a given search depth is reached.Very quickly this can result in very large search area.Future MovesTo improve the play of the AI the benefit of possible moves is calculated.For each move of player 1 each possible move of player 2 is calculatedFor each move of player 2 each possible move of player 1 is calculatedThis is repeated until a given search depth is reached.When a given depth is reached the value of that path is calculated.Very quickly this can result in very large search area.Future Moves

For all RedFuture Moves

812For all Red{8,12}

Future Moves

812For all Red{8,12},{9,12}912Future Moves

812For all Red{8,12},{9,12},{9,13}

912913Future Moves

812For all Red{8,12},{9,12},{9,13},{10,13},

9129131013Future Moves

812For all Red{8,12},{9,12},{9,13},{10,13},{10,14}

91291310131014Future Moves

812For all Red{8,12},{9,12},{9,13},{10,13},{10,14} ,{11,14}

912913101310141114Future Moves

812For all Red{8,12},{9,12},{9,13},{10,13},{10,14} ,{11,14}

9129131013101411141115Future Moves

812Whites counter move{8,12},{9,12},{9,13},{10,13},{10,14} ,{11,14},{11,15}

2016201721172118221822192319REDWHITEFuture Moves

812Whites counter move{8,12},{9,12},{9,13},{10,13},{10,14} ,{11,14},{11,15}

2016201721172118221822192319REDWHITEFuture Moves

812Whites counter move{8,12},{9,12},{9,13},{10,13},{10,14} ,{11,14},{11,15}

2016201721172118221822192319REDWHITEFuture Moves

812Whites counter move{8,12},{9,12},{9,13},{10,13},{10,14} ,{11,14},{11,15}

2016201721172118221822192319REDWHITEParallel ProcessingCant have player 2 waiting for player 1s move to be completed.Search must be conducted in a timely manner. To improve performance multiple branches of the future move table are computed at the same time. Parallel ProcessingPlayer 1Player 2Player 2Player 2Player 2Player 2Player 2Player 2Each set of responses are run as a separate threadsEach set can be computed independently of other sets of the same or greater depth as well as steps that did not directly precede it.P7P6P5P4P3Parallel ProcessingPlayer 1Player 2Player 2Player 2Player 2Player 2Player 2Player 2This allows the task of searching for the best move to be split among multiple processors as well as multiple threads.This makes it well suited to being run on the cluster P1P2Using the Future TableWhen a move made by player 1 or player 2 make a path in the table no longer possible they are removed.The path that yields the highest possible point value is taken.The point value of a path is determined by multiple factors.Jumping a man gets pointsTaking a king gets more points than taking a manPoints are deducted for being jumped and losing piecesPoint values for each move are determined by the total value of the possible paths that result.Work in ProgressFinish ThreadingMigrate to ClusterKing jump logicRequires a modification to the man jump logicEnd game detectionDrawIf nothing changes in the future lookup within 40 moves call it a draw.Finalize point strategy

Search related