chess applications:alpha- beta search greg parker ‘03 senior thesis advisor: andrew appel

25
Chess Applications:Alpha- Beta Search Greg Parker ‘03 Senior Thesis Advisor: Andrew Appel

Upload: lorraine-mason

Post on 27-Dec-2015

223 views

Category:

Documents


3 download

TRANSCRIPT

  • Slide 1
  • Chess Applications:Alpha- Beta Search Greg Parker 03 Senior Thesis Advisor: Andrew Appel
  • Slide 2
  • Problem Description n 1. Overall Outlook - Create a chess application capable of competing at an ELO rated 800 level n 2. Analyze tradeoff between evaluation function and search depth measured in nodes/sec
  • Slide 3
  • Overall Goal - Application Rating of ELO 800 n ELO rating System n 1400Class D or C n 1600Class C or B n 1800Class B or A n 2000Class A or Expert n 2200Expert or NM n 2300National Master n 2520International Master n 2600Grandmaster n 2700+Super Grandmaster
  • Slide 4
  • Analyze Tradeoffs in Nodes/sec with evaluation and search depth n Ultimate goal is best possible computer chess application - tradeoff between smarter evaluation function and deeper search depth
  • Slide 5
  • Slide 6
  • History of Chess Computing n 1950 - Claude E. Shannon writes first articles on computer chess - notes the existence of a perfect solution to chess and the practical impossibility of finding it - He described two types of strategies Type A - expand all sequences to a certain depth, rely heavily on evaluation Type B - prune some sequence branches n 1956 - Type A program on MANIAC-1(11 Khz, 600 words of mem) - does 4-ply search in 12 minutes n 1957 -Type B program on IBM 704(42 Khz, 7K words), does 4-ply search in 8 minutes
  • Slide 7
  • History of Chess Computing Continued n 1958 - Newell, Simon and Shaw introduce alpha-beta pruning n 1962 - Alan Kotok thesis project from MIT called MacHack (IBM 7090) examines 1100 nodes/minute n 1967 - MacHack 6 on DEC PDP-6 (200 Khz) examines 10 nodes/sec n 1973 - Slate and Atkin produce type A program Chess 4.0 that examines 300 - 600 nodes/sec n 1977 - Chess 4.6 beats a grandmaster at speed chess n 1983 - Cray Blitz examines 40-50K nodes/sec
  • Slide 8
  • History of Chess Computing Continued n 1988 - Deep Thought built by CMU grad students searches 750,000 nodes/sec or 10-ply, it becomes first computer to beat Grandmaster Bent Larsen n 1989 - Deep Thought loses exhibition to Garry Kasparov the world champion n 1993 - Deep Thought defeats Grandmaster Judit Polgar n 1996 - Deep Blue (on 32 processor parallel computer with 256 VLSI chess engines) beats Kasparov in first game, but loses match
  • Slide 9
  • History of Chess Computing - Current n 2001 - Deep Junior(dual Pentium - 933 w/768Mb RAM) loses to Deep Fritz n 2003 - Jan. - Feb. Deep Junior 8 (on Win2000 Server with eight 1.6 GHz Intel chips, 8 Gb RAM) draws Garry Kasparov in NYC
  • Slide 10
  • My Approach - What is alpha- beta? n Explain general alpha-beta pruning int alpha_beta(int alpha, int beta, int depth) Creates cutoffs in minimax Alpha-beta window used to help prune unneeded branches Depths are alternated between min and max starting at root At depth = 0, evaluation is returned At each depth the evaluation of the recursive alpha-beta call is either minimized or maximized within the alpha - beta window
  • Slide 11
  • Shallow Alpha-Beta Search
  • Slide 12
  • Alpha-Beta Definition McGill University Computer Science Department n ALPHA-BETA search is a method that reduces the number of nodes explored in Minimax strategy. It reduces the time required for the search and it must be restricted so that no time is to be wasted searching moves that are obviously bad for the current player. The exact implementation of alpha-beta keeps track of the best move for each side as it moves throughout the tree. n We proceed in the same (preorder) way as for the minimax algorithm. For the MIN nodes, the score computed starts with +infinity and decreases with time. For MAX nodes, scores computed starts with -infinity and increase with time. n The efficiency of the Alpha-Beta procedure depends on the order in which successors of a node are examined. If we were lucky, at a MIN node we would always consider the nodes in order from low to high score and at a MAX node the nodes in order from high to low score. In general it can be shown that in the most favorable circumstances the alpha-beta search opens as many leaves as minimax on a game tree with double its depth
  • Slide 13
  • How is my approach implemented? n Nimbus 2003 Version 3.0 - Searched 2500 nodes/sec n Currently searching 4,000-5000 nodes/sec n Evaluation Function - Tests for Material Pawn Positioning Central and Passed Pawns Rook on the 7th Rank Attacking Pieces
  • Slide 14
  • Details of my Work n Alpha-Beta Alpha-Beta Pruning Within alpha-beta check for legality of moves (using is_check) n Basic Evaluation - Represented by floating point Material Pawn - 1 pt. Knight and Bishop - 3 pts. Rook - 5 pts. Queen - 10 pts. King - Infinite
  • Slide 15
  • Continuation of Implementation Details n Evaluation Pawn Positioning -.25 points for a protected pawn Central Square control -.25 points per square Rook on the seventh Rank -.5 points Attacking Squares -.005 points
  • Slide 16
  • Analysis of Tradeoffs n Each extra-ply represents approximately 250 ELO points n * It is not worth it to make an elaborate evaluation function until you have exhausted total search efficiency
  • Slide 17
  • Gprof Profiling n Used to gprof profiling command within unix to aid in efficiency testing 1. Fixed addhash and removehash - removehash is O(1), addhash is O(N) 2. Original possible_moves took 70 % of running time.08 ms/call 3. After efficiency tuning it is 49% of running time and.03 ms/call
  • Slide 18
  • Slide 19
  • Slide 20
  • Slide 21
  • Start Results n Depth 4 vs. Chessmaster rated 800 opponent - Currently a draw - makes some fatal checking errors (gets greedy) n Evaluation needs to be tuned to more positional base n Alpha-Beta Search currently searches 4500 nodes/sec ( previous was 1 - 2,000)
  • Slide 22
  • Results Continued n Final Report Continue to gather results of Nimbus 2003 vs. Chessmaster Rated Matches Depth Matches - Test Evaluation Heuristic Perhaps have Professor Appels son (rated 1300) play against the program Chart the progress of nodes/sec and total nodes searched for each version
  • Slide 23
  • Results Nimbus 2003 Version 4.0 vs. Kendra(800) [Chessmaster 8000 rated game]
  • Slide 24
  • Slide 25
  • Conclusions/Things I am working on before May 5th n Things I am currently working on Refining the evaluation function Searching to greater depth Testing learning algorithm for evaluation function n Conclusions Currently it is on par or better than Chessmasters 800 rated player Hoping to be able to get rating up to 1200