Author: Sean Mintz
Date: 17:16:33 02/21/06
I have been working on the basic underpinnings of an 0x88 program. By today it had gotten to the point where it was working well enough that I could tinker and make some comparisons. The initial version's move generator is, in terms of its code, very long. 1. Generate castling moves 2. Generate en passant moves 3. Big switch statement, seperated by each type of piece. Pawn is seperated further into white and black and each of those is split into normal or promotion moves. The attack function in this program ( used to determine whether the king is in check ) is very similar to the move generator. It sort of generates the moves backwards to determine whether the square is being attacked. The code for this version is fairly lengthy, but runs quite fast. Today I tried rewriting the move generator and the attack function to be shorter and to take advantage of some of the talked about "tricks" of 0x88 ( specifically in the attack function ). The move generator now looks like this: 1. Generate castling moves 2. Generate en passant moves 3. Smaller switch statement. Do pawn moves, but then do all other moves together ( has an array to determine whether a piece is a slider or not, and a multidimensional array that says which directions a piece can go ) The attack function is similar to that of Gerbil, but I do pawns seperately ( as opposed to having another multidimensional array to handle the pawns ). On to the tests: First I perft to a depth of 6. This takes reasonably long. After that I do 3 repetitive tests. First I generate all 20 moves for the initial position 2.5 million times. Then I make and unmake each of those 20 moves 2.5 million times. Then I run the attack function on the white AND black king 2.5 million times ( so the attack function runs 5 million times ). On to the results: Version One Calculating Perft to depth 6 ... 119060324 Took 19.44 seconds Performing Move Generator Test ... Took 0.922000 seconds Performing Move Make Test ... Took 2.243000 seconds Performing Attack Test ... Took 0.320000 seconds Version Two Calculating Perft to depth 6 ... 119060324 Took 24.48 seconds Performing Move Generator Test ... Took 1.932000 seconds Performing Move Make Test ... Took 2.214000 seconds Performing Attack Test ... Took 0.410000 seconds I was personally surprised to see the second version running so much slower. Sean Mintz
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.