Techniques to Parallelize Chess Matthew Guidry, Charles Mcclendon

Techniques to Parallelize Chess Matthew Guidry, Charles Mcclendon

Techniques to Parallelize Chess Matthew Guidry, Charles McClendon move-repetition, and others that force a Abstract game to end as a draw. Computer chess has, over the years, 2. Developing a Chess Engine served as a metric for showing the progress of computer science. It was There are many factors to consider a momentous occasion when IBM’s when building a computer chess engine, a Deep Blue was able to defeat world program that performs the computations champion Garry Kasparov. Many required to determine the best move. hardware based chess computers Firstly, one must decide how to represent have been developed; however in an the chess board. A naïve approach would be age of multi-core it will be expected to simply create an 8x8 two-dimensional array. However, there are a few problems that the progress will continue to with this strategy. Firstly, this may utilize advance despite the end of the free more memory than necessary. Secondly, lunch given by Moore’s Law. We and more importantly, there are other kinds present methods involved in of representations that can allow for very parallelizing a chess engine. We then fast operations. The most common present a discussion of our optimized representation of a chess board is to use the concept of “bit-boards.” The implementation of such an engine. entire state of a chess game could potentially be represented by 12 processor 1. Introduction words (this is particularly effective on 64-bit processors). One processor word, or bit- The area of programming chess has board, could represent the location of white spanned over 50 years and many different pawns, one for black pawns, etc. By using kinds of techniques have been utilized. In such a representation we may perform 1950, information theorist Claude Shannon various operations, such as finding the published a groundbreaking paper entitled location of all white material by using very “Programming a Computer for Playing fast bit-wise operations such as AND, OR, Chess” that proved pivotal for future work etc. on chess. Chess is a game of “perfect Another key, albeit secondary, information,” which means that all players factor that chess engine developers must know the entire state of the game and all consider is what “interface” they will previous game moves. This, of course, is support to allow others to play matches different from other games such as poker or against their engine. Since there are literally bridge. Other games of perfect information hundreds of different chess engines, a include Tic-Tac-Toe and Go. Chess is also a common approach is to design a chess finite game because of the 50-move, 3- engine to use a common chess playing protocol that may be used by some proxy program that presents a graphical user interface while interacting with the chess engine via standard input and output mechanisms. Two common such protocols are Tim Mann’s XBoard protocol and the Universal Chess Interface (UCI). Thus, most chess engines do not include a GUI but rather support one of these protocols and a user would use a program such as Winboard in order to play against a chess engine or to pit two engines against each other. The primary component of a chess instance, at the beginning of a game, engine, of course, is its “thinking” white’s tree would have 20 immediate algorithm. The basic idea utilized by a chess children from the root node (16 possible engine, or any game engine that plays a pawn moves and 4 possible knight moves). game of perfect information, is to simulate Of course, every child node has some many moves ahead from the current number of other child nodes representing position in order to determine the best next all possible moves from that position. move. A typical chess engine will begin Figure 1 describes an example game tree “thinking” once its turn begins and ends for Tic-Tac-Toe. once it has determined the “best move.” Of course, the method used to This thinking engenders a certain amount of search the game tree and evaluate each non-trivial computation therefore some board configuration is the most critical chess engines support “pondering,” which is factor in developing a powerful chess a technique whereby an engine will attempt engine. In chess, each move by a single to determine the next best move while its player is referred to as a “ply.” Most chess opponent is determining its best move; this engines search a predetermined number of strategy simply gives the engine more time ply (or nodes of the game tree). A major to compute a best move or allows the game issue with this approach is that clearly we to progress more quickly in an untimed cannot practically examine all possible match. moves from a given position as the search space becomes exponentially large. A 3. Minimax typical chess engine will only search between 4 and 7 ply as the amount of time required to find a “best move” tends to Chess engines perform this become very large. The idea here is that simulation by building a game tree of given more ply, a chess engine can make a moves. Each node represents the game better decision so optimizing a chess engine state or board configuration. At the root of usually involves increasing the amount of the tree is the current board configuration. ply that can be searched for some time t. The immediate children of the root node The most common move search are all of the next possible moves. For algorithm for games of perfect information, algorithm works by recursively looking at each node in a game tree, to a certain depth, and returning the “value” of each node using the evaluation function. Figure 2 depicts the pseudo code of minimax. 4. Alpha Beta Pruning One can build a very workable chess engine by simply using minimax and good evaluation function; however the canonical particularly two-player zero sum games minimax algorithm does not fully exploit such as chess, is the minimax algorithm. the engines potential. Consider that for a The minimax algorithm is based on the given maximum depth (or maximum minimax theorem: “For every two-person, number of ply) there may be many paths zero-sum game with finite strategies, there computed that will never actually be exists a value V and a mixed strategy for exercised. For instance, if you assume that each player, such that (a) Given player 2's your opponent is at least as good as you strategy, the best payoff possible for player then you can eliminate paths that involve 1 is V, and (b) Given player 1's strategy, the the opponent making moves that are too best payoff possible for player 2 is -V.” [1] beneficial for you (i.e. giving up a queen for The main idea behind the algorithm an isolated pawn). By making such is that one player attempts to minimize the eliminations, the search space can be maximum payoff of the other player and in greatly reduced and the chess engine may a zero sum game this process will tend to search more useful plies. This approach is produce positive outcomes for the first referred to as alpha-beta pruning [3]. player [2]. The crux of the algorithm lies in To use minimax with alpha beta an evaluation function; this function is how pruning, we may simply extend the minimax we determine if a potential move is better algorithm to accept additional inputs alpha than others. Besides improving the number and beta representing the best score each of ply an engine can search one can player, current player and opponent optimize an engine’s play by improving the respectively. The initial invocation of the evaluation function. A simple evaluation algorithm would entail setting alpha = -∞ function may entail comparing the sums of and beta = ∞. Alpha beta pruning can, on the relative chess values of all the material average, reduce the branching factor b of a for each player, white and black (for game tree toward a factor approximating instance, 1 point is given for a pawn and 3 O(sqrt(b)) [4]. points are given for a knight or bishop, etc). To optimize this simple strategy one may 5. Using Transposition Tables then consider positional factors such as only awarding .5 points for an isolated pawn and so forth. Good chess engines include even Another optimization technique one more complex heuristics for their may consider to use is what’s known as a evaluation functions. The minimax transposition table. A transposition table is essentially a kind of cache whereby a chess made more efficient if we had an estimate engine can store the results of previous of nodes at depth d-1 and below (we would searches of particular board configuration have, in effect, more cutoffs from our alpha (game tree nodes). This technique beta pruning). Thus, iterative deepening essentially memoizes the recursive search refers to this process where we begin by algorithm. This table is essentially performing our search with a maximum implemented as a hash table with the game depth of 1 and increment the maximum state as the key and the value being value depth by one and search again and we of the board configuration as determined continue this process until we search at our by search. Thus, we may modify our true maximum depth (i.e. 7 ply). Every time recursive minimax with alpha beta pruning the search function is called, certain cost algorithm by including a step to consult the estimates would be set that would inform transposition table.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us