1 / 48

HPC Checkers

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.

greg
Download Presentation

HPC Checkers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HPC Checkers By Andy Block Ryan Egan

  2. 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

  3. Overview of Checkers • 8x8 checkered board using only the black squares • 32 positions • Search space of 5x1020 • Each Player starts with 12 men

  4. Rules of Checkers • Pieces • Men can only move forwarded diagonally 1 space • Kings can move forwarded and backward diagonally 1 space • Upon reaching the opposite back row men become kings • Each player starts with 12 men • Jumping • Men and kings are required to jump when possible • Multiple jumps are allowed and required when possible • When a man or king is jumped it is removed from the board • If a man jumps into the back row and becomes a king the turn is ended.

  5. Rules of Checkers cont. • Start Game • Red always moves first • End Game • The game ends when one player can no longer move • Game can end it a draw

  6. AI Theory • Heuristics • Not perusing paths that appear to not be as beneficial as other paths • Alpha-beta pruning • Planning • Future moves are calculated to generate a plan of attack that maximizes benefit and minimizes loss.

  7. The Program • The Board • Stored as 33 value integer array • Starting 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.

  8. The Program cont. • Jumps • For men jumps form a directed and acyclic graph (DAG) • A breadth first search is used to build a list of adjacent jumpable locations • Starting 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.

  9. Sample Jump 2 {2 Enqueue Root (2)

  10. Sample Jump 2 {2 Look Left (9)

  11. Sample Jump 2 9 {2 Enqueue (9)

  12. Sample Jump 2 9 {2 Look Right

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

  14. Sample Jump 2 9 16 {2,9}, Enqueue (16)

  15. Sample Jump 2 9 16 {2,9}, Look Right (18)

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

  17. Sample Jump 2 9 16 18 {2,9},{9,16}, Look Left

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

  19. Sample Jump 2 9 16 18 25 {2,9},{9,16}, Enqueue (18)

  20. Sample Jump 2 9 16 18 25 {2,9},{9,16},{9,18}, Look left

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

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

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

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

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

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

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

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

  29. Future Moves • For each move of player 1 each possible move of player 2 is calculated • For each move of player 2 each possible move of player 1 is calculated • This is repeated until a given search depth is reached. • Very quickly this can result in very large search area.

  30. Future Moves • To 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 calculated • For each move of player 2 each possible move of player 1 is calculated • This 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.

  31. Future Moves For all Red

  32. Future Moves 8 12 {8,12} For all Red

  33. Future Moves 8 12 9 12 {8,12},{9,12} For all Red

  34. Future Moves 8 12 9 12 9 13 {8,12},{9,12},{9,13} For all Red

  35. Future Moves 8 12 9 12 9 13 10 13 {8,12},{9,12},{9,13},{10,13}, For all Red

  36. Future Moves 8 12 9 12 9 13 10 13 10 14 {8,12},{9,12},{9,13},{10,13}, {10,14} For all Red

  37. Future Moves 8 12 9 12 9 13 10 13 10 14 11 14 {8,12},{9,12},{9,13},{10,13}, {10,14} ,{11,14} For all Red

  38. Future Moves 8 12 9 12 9 13 10 13 10 14 11 14 11 15 {8,12},{9,12},{9,13},{10,13}, {10,14} ,{11,14} For all Red

  39. Future Moves RED WHITE 8 12 20 16 20 17 21 17 21 18 22 18 22 19 23 19 {8,12},{9,12},{9,13},{10,13}, {10,14} ,{11,14},{11,15} White’s counter move

  40. Future Moves RED WHITE 8 12 20 16 20 17 21 17 21 18 22 18 22 19 23 19 {8,12},{9,12},{9,13},{10,13}, {10,14} ,{11,14},{11,15} White’s counter move

  41. Future Moves RED WHITE 8 12 20 16 20 17 21 17 21 18 22 18 22 19 23 19 {8,12},{9,12},{9,13},{10,13}, {10,14} ,{11,14},{11,15} White’s counter move

  42. Future Moves RED WHITE 8 12 20 16 20 17 21 17 21 18 22 18 22 19 23 19 {8,12},{9,12},{9,13},{10,13}, {10,14} ,{11,14},{11,15} White’s counter move

  43. Parallel Processing • Can‘t have player 2 waiting for player 1’s 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.

  44. Parallel Processing Player 1 • Each set of responses are run as a separate threads • Each set can be computed independently of other sets of the same or greater depth as well as steps that did not directly precede it. Player 2 Player 2 Player 2 Player 2 Player 2 Player 2 Player 2

  45. Parallel Processing Player 1 • This 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 Player 2 Player 2 Player 2 Player 2 Player 2 Player 2 Player 2 P1 P2 P3 P4 P5 P6 P7

  46. Using the Future Table • When 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 points • Taking a king gets more points than taking a man • Points are deducted for being jumped and losing pieces • Point values for each move are determined by the total value of the possible paths that result.

  47. Work in Progress • Finish Threading • Migrate to Cluster • King jump logic • Requires a modification to the man jump logic • End game detection • Draw • If nothing changes in the future lookup within 40 moves call it a draw. • Finalize point strategy

More Related