1README.simplech 2 3 ----------> name: simple checkers 4 ----------> author: martin fierz 5 ----------> purpose: platform independent checkers engine 6 ----------> version: 1.11 7 ----------> date: 8th october 98 8 ----------> description: checkers.c contains a simple but fast 9 checkers engine and a simple interface to this engine. checkers.c 10 contains three main parts: interface, search and move 11 generation. these parts are separated in the code. if you want to 12 improve on the play of checkers, you will mainly have to improve on 13 the evaluation function; this version does nothing but count 14 material. even though it only counts pieces, this checkers engine 15 will blow away all shareware checkers programs you will find on the 16 internet, with the exception of blitz54, which is written for DOS. 17 18 board representation: the standard checkers notation is 19 20 (white) 21 32 31 30 29 22 28 27 26 25 23 24 23 22 21 24 20 19 18 17 25 16 15 14 13 26 12 11 10 9 27 8 7 6 5 28 4 3 2 1 29 (black) 30 31 the internal representation of the board is different, it is a 32 array of int with length 46, the checkers board is numbered 33 like this: 34 35 (white) 36 37 38 39 40 37 32 33 34 35 38 28 29 30 31 39 23 24 25 26 40 19 20 21 22 41 14 15 16 17 42 10 11 12 13 43 5 6 7 8 44 (black) 45 46 let's say, you would like to teach the program that it is 47 important to keep a back rank guard. you can for instance 48 add the following (not very sophisticated) code for this: 49 50 if(b[6] & (BLACK|MAN)) eval++; 51 if(b[8] & (BLACK|MAN)) eval++; 52 if(b[37] & (WHITE|MAN)) eval--; 53 if(b[39] & (WHITE|MAN)) eval--; 54 55 the evaluation function is seen from the point of view of the 56 black player, so you increase the value v if you think the 57 position is good for black. 58 59 if you want to program a different interface, you call the 60 function "checkers": 61 62 checkers(int b[46],int color, double maxtime, char *str); 63 64 in b[46] you store the position, each square having one of 65 the values of {FREE, BLACK|MAN, BLACK|KING, WHITE|MAN, WHITE|KING, 66 OCCUPIED}. OCCUPIED are those squares which do not appear in the 67 above board representation, i.e. 0,1,2,3,9,18,27,36,41-45. 68 color is the color to move, either BLACK or WHITE. 69 maxtime is the about half the average time it will take to 70 calculate a move. 71 72 after checkers completes, you will have the new board position in 73 b[46] and some information on the search in str. 74 75 initcheckers(int b[46]) initializes board b to the starting 76 position of checkers. 77 78 have fun! 79 80 questions, comments, suggestions to: 81 82 Martin Fierz 83 mafierz@ibm.net 84