You are on page 1of 23

1

Index Preface Introduction History Levels of solving a game Solving checkers Implementation Demonstration Screen shots Conclusion References 3 4 5 6 8 14 15 19 20 21

PREFACE Checkers is a game played on an eight by eight squared board with twelve pieces on each side, each might only initially move and capture diagonally forwards, and it can move both backwards and forwards only when the piece is Kinged. As long as the checkers can be unbeatable game, Arthur Samuel thought about using the Lees guide to Checkers for creating a learning game that will adjust the criteria for choosing the moves, The program was able to learn from its errors and achieved an impressive playing strength. It was capable of beating the world champion of checkers at that time. As a hint from the book Checkers is Solved By Jonathan Schaeffer, Neil Burch, Yngvi Bjrnsson, Akihiro Kishimoto, Martin Mller, Robert Lake, Paul Lu, Steve Sutphen. Science (4 September 2007: Vol. 317. no. 5844, pp. 1518 - 1522): "The game of checkers has roughly 500 billion billion possible positions (5 x 1020). The task of solving the game, determining the final result in a game with no mistakes made by either player, is daunting. Since 1989, almost continuously, dozens of computers have been working on solving checkers, applying state-of-the-art artificial intelligence techniques to the proving process. This paper announces that checkers is now solved: Perfect play by both sides leads to a draw. This is the most challenging popular game to be solved to date, roughly one million times as complex as Connect Four. Artificial intelligence technology has been used to generate
3

strong heuristic-based game-playing programs, such as Deep Blue for chess. Solving a game takes this to the next level by replacing the heuristics with perfection."

Introduction Its not easy to solve a game, specially that the result to be shown in the final of the game has to be with no mistake depending on any move that can be done by the player, any thought should be considered in checkers specially that there are assumptions that have been made about any step a play can do with a piece, and these assumptions are not just about the next move but they are about every move that can be done during the whole game period from start point till the end point including when the piece becomes a king and can move backwards and forwards. Many computers have been used to solve the game applying state-of-the-art artificial intelligence techniques to the proving process and many others have been participating in competitions against real human players, thats why it is always respected to know or make an assumption of what next move a player can have. This presentation describes the way of solving the game and it is a description of a start of designing an unbeatable game that can make all assumptions that have been mentioned, This game was already made by many researchers, even though it is good to study what have been made, to implement what have been created and to know what have been produced.

History It is a board game that in the UK they call it draughts which is one of the oldest games ever known to man in Europe, once tracing its history we can go back to the cradle of civilization where vestiges of the earliest form of the game was unearthed in an archeological dig in the ancient city of Ur in southern Mesopotamia, which is now modern day Iraq. no one is sure of the exact rules of the game which was carbon dated at 3000 B.C. A similar game using a 5x5 board, called Alquerque is known to have existed in ancient Egypt as far back as 1400 B.C. Checkers (known as draughts in the United Kingdom and some other countries), also called American checkers, straight checkers, or simply draught, is a form of draughts board game played on an eight by eight squared board (with sixty-four total squares) with twelve pieces on each side. These pieces may only initially move and capture diagonally forwards. Only when a piece is "crowned" or "kinged" may it move both backwards or forwards. As in all draughts variants, English draughts is played by two people, on opposite sides of a playing board, alternating moves. Traditionally the pieces are either black, white, or red, and the board alternates between red and white squares. The opponent's pieces are captured by jumping over them.

Levels of solving a game It is not easy solving a game, especially that there are many steps to be done during the playing period, each step might have hundreds of assumptions, each step the human player can think about should be put as an assumption and that is not easy since its kind of impossible to get into the human mind, even though its not impossible to think about what a human mind might think, except in order to solve a game there are levels of solving it , these levels can be put as following:

Ultra-Weakly solving: The game-theoretic value for the initial position has been determined.

Weakly solved: The game is ultra-weakly solved and a strategy exists for achieving the game-theoretic value from the opening position,

assuming reasonable computer resources.

Strongly solved: For all possible positions, a strategy is known for determining the game theoretic value for both players, assuming

reasonable computing resources. Given the rules of any two-person game with a finite number of positions, one can always trivially construct a minimax algorithm that
7

would exhaustively traverse the game tree. However, since for many non-trivial games such an algorithm would require an infeasible amount of time to generate a move in a given position, a game is not considered to be solved weakly or strongly unless the algorithm can be run by existing hardware in a reasonable time. Many algorithms rely on a huge pre-generated database, and are effectively nothing more than that. As an example, the game of tic-tac-toe is solvable as a draw for both players with perfect play (a result even manually determinable by schoolchildren). Games like nim also admit of a rigorous analysis using combinatorial game theory. Whether a game is solved is not necessarily the same as whether it remains interesting for humans to play. Even a strongly solved game can still be interesting if the solution is too complex to be memorized; conversely, a weakly solved game may lose its attraction if the winning strategy is simple enough to remember (e.g. Maharajah and the Sepoys). An ultra-weak solution (e.g. Chomp or Hex on a sufficiently large board) generally does not affect playability. By David Epstein.

Solving checkers Checkers might be a strongly solved game, there have been thoughts made, calculations has been created about the probabilities each piece of checkers can have, and after all there have been considerations of all possible positions. It took the researcher and programmer Schaeffer almost 16 years to create his checkers odyssey, he invented CHINOOK which is the first program to win in the world championship against a human being in checkers, this program was made in 1989, the endgame database has been created to trace backwards from the final results of games such as wins, losses or draws then there was a deep search algorithm made to make decisions during play based on evaluating all possible outcomes a certain number of moves ahead. Schaeffer said: Strongly solving the game or computing all of these
possible positions would have taken decades, but what he did was firstly creating a database of the endgames building backward from all the possible wins, losses or draws that the checkers can include, he created also an algorithm about backward searching that builds the path of situations that can lead the mentioned endgames to the point where exist 10 game pieces on the board, the result that he came up with was a database of 39 trillion positions compressed using homebrew algorithm into an average of 237 gigabytes for an average of 154 positions per byte of data. 9

Backward searching algorithm is one thing, the next step to be done is the forward search technique which is by the way not performed in the way Chinook because it used a deep search algorithm to make the next move always by analyzing all possible situations that are one move deep then all possible situations that are two moves deep and so on till the end. There is another technique that actually was also made in Chinook, this technique is called best first which prioritize the searching various positions and lines of play at a given position in the games where there are several possible moves that can be made. As a definition of each technique to be made: Backward search: the positions at the end are being searched with their win/loss/draw value determined, the technique used in this algorithm is the retrograde analysis which has been successfully used for many games, the algorithm is called backward search because it works backward by starting at the end of the game and working toward the start, it also enumerates all one piece positions declaring each value of each position then it goes to the two piece position which of course leads also to a one piece position with a known value the again the three piece positions and so on, the endgame databases are crucial to solving checkers which forced to capture rule quickly results in many pieces being removed from the board giving rise to a position with less than 10 pieces and a known value. Forward search: consists of two parts: the proof tree manager that builds the proof by defining the positions to be assessed and the proof solvers which search individual positions, the manager maintains the master copy of the 10

proof and uses the proof number search algorithm to identify a prioritized list of positions that need to be examined, typically several hundred positions of interest are generated at a time so as to keep multiple computers busy. As the checkers board, each square where the pieces can take a move was converted into a number to be used in algorithms and diagrams.

Respecting the above board assumptions was made and number of positions was declared as following:

11

The number of positions in the game of checkers. For example, the possible positions for one piece include 32 squares for the Black king, 32 squares for the White king, 28 quares for a Black checker, and 28 squares for a White checker, for a total of 120 positions.

Forward and backward search. The number of pieces on the board are plotted vertically) versus the logarithm of the number of positions (Table 1). The shaded area shows the endgame database part of the
12

proofi.e., all positions with !10 pieces. The inner oval area shows that only a portion of the search space is relevant to the proof. Positions may be irrelevant because they are unreachable or are not required for the proof. The small open circles indicate positions with more than 10 pieces for which a value has been proven by a solver. The dotted line shows the Boundary between the top of the proof tree that the manager sees (and stores on disk) and the parts that are computed by the solvers (and are not saved in order to reduce disk storage needs). The solid seeded line shows a best sequence of moves.

13

Table 2. Openings solved. Shown are the opening moves (using the standard square number scheme in Fig. 1, bottom), the result, the number of positions given to the solvers, and the position farthest from the start of the game that was searched (Max ply). The last two columns give the size and ply depth of the pruned minimal proof tree. Note that the total does not match the sum of the 19 openings. The combined tree has some duplicated nodes, which have been removed when reporting the total.

Fig. 3. The first three moves of the checkers proof tree. Move sequences are indicated using the notation from Fig. 1B, with the from-square and to-square of the move separated by a hyphen. The result of each position is given for Black, the first player to move (=D, a proven draw; =L, a proven loss; <=D, loss or draw; and >=D, draw or win). In some positions, only one move needs to be

14

considered; the rest are cut off, as indicated by the rotated T. Some positions have only one legal move because of the forced-capture rule.

15

Implementation The implementation of the checkers should respect the table of positions and should demonstrate:
Alpha Beta Pruning :

technique for greatly reducing the number of moves searched to get the exact same result. it is possible to reach up to almost twice the search depth (if optimal,) by searching the same number of positions. It is optimal if any time a player has one or more moves good enough to cause a cut-off, one of these moves is searched first. Therefore to get the most out of alphabeta, you have to try to predict the best move for the player to move, and try this move first.
Iterative Deepening :

starting with shallow searches before running a deeper search.


Transposition Table (Hash Table):

It is a table in memory that stores information about board positions previously searched. A plain Alpha-Beta search function will search any board it receives, but this is wasteful if it has already encountered and searched this board before in another branch of the search. Quiescence Search
16

It is a necessary in checkers, where the evaluation is based greatly on material pieces. A quiescence search means searching certain board positions further before evaluating the board. Demonstration I did not create a game that plays against computer because it takes a long time to do so, but I did create a game that whenever you touch a piece it gives you the positions that can be done next. This is a code from the main class of the java game: import java.awt.*; import java.awt.event.*; import javax.swing.*;

public class draughts extends JPanel implements ActionListener {

private windowDraughtsBoard draughtsBoard; private objCreateAppletImage createImage;

private JButton cmdNewGame; private JPanel panBoard, panStatusArea, panButton; private Color clrBackgrounds;

17

public static void main(String[] args) {

JFrame.setDefaultLookAndFeelDecorated(true);

JFrame frame = new JFrame("Draughts"); //Title frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JComponent paneMain = new draughts(); paneMain.setOpaque(true); paneMain.setPreferredSize(new Dimension(550, 600)); frame.setContentPane(paneMain);

frame.pack(); frame.setVisible(true);

public draughts() {

super.setLayout(new BorderLayout());
18

createImage = new objCreateAppletImage(); draughtsBoard = new windowDraughtsBoard();

try {

Image coinRed = createImage.getImage(this, "coinRed.gif", 500); Image coinBlue = createImage.getImage(this, "coinBlue.gif", 500); Image coinRedKing = createImage.getImage(this, "coinRedKing.gif", 500); Image coinBlueKing = createImage.getImage(this, "coinBlueKing.gif", 500); draughtsBoard.setupCoins(coinRed, coinBlue, coinRedKing, coinBlueKing);

} catch (NullPointerException e) { }

draughtsBoard.setSize(new Dimension(500,500));
19

cmdNewGame = new JButton("New Game"); cmdNewGame.addActionListener(this);

panBoard = new JPanel(); panButton = new JPanel(); add(panBoard, BorderLayout.NORTH); panBoard.add(draughtsBoard); add(panButton, BorderLayout.SOUTH); panButton.add(cmdNewGame); clrBackgrounds = new Color(75,141,221); setBackground(clrBackgrounds); panBoard.setBackground(clrBackgrounds); panButton.setBackground(clrBackgrounds); } public void actionPerformed(ActionEvent e) { draughtsBoard.resetBoard(); } }

Screen-shots
20

21

Conclusion It is not easy to solve a game , there are always many phases to be followed and many techniques to be done, with the current existing technology it is possible to weakly solve a game, specially that a database contains a proof tree for the game can contain many nodes which is a small number by todays standards, to solve the game strongly it requires more nodes to be reached in the game. As mentioned in this paper the results of Chinook demonstrated a super powers byt defeating a human being, the project was a success that belongs to both AI and parallel computing. So the checkers calculations always eliminate the boundaries of what can be achieved by search intensive algorithms. Now that the checkers is solved the question remains how solved is it? all or almost, are the assumptions enough or missing something, as long as algorithms show up from nowhere , thoughts are developing everywhere question will be always put.

22

References Uwic Library J. Schaeffer et al., Solving Checkers (www.ijcai.org/papers/0515.pdf, 2005). J. Schaeffer et al., in Advances in Computer Games, J. van den Herik, H. Iida, E. Heinz, Eds. (Kluwer, Dordrecht, Netherlands, 2003). Wikipedia Longest 10PC MTC (http://pages.prodigy.net/eyg/Checkers/longest-10pcmtc. htm, 2007).

23