Author: Vincent Diepeveen
Date: 22:08:31 01/01/05
Hello, I managed to speedup the diep move generator a tad. The move generator is GPL. I just post the relevant code here where something changed. To get all the code, ship me an email or go to the FSF. When generating piecemoves: else { int *t; t = cancapside[side]; if( sweep[piece] ) { int *s,*v,*w,u; s = andscan[0]; v = ipiecepos[piece][sq]; w = iskippos[sq]; u = *v++; do { int p1=snelbord[u],sh=w[u]; v += (s[p1]&sh); if( ((p1-1)>>3) != side ) { Link(SRsq|u|t[p1]); } } while( (u=*v++) != 128 ); } else { int u,*v; v = ipiecepos[piece][sq]; u = *v++; do { int p1 = snelbord[u]; if( ((p1-1)>>3) != side ) { Link(SRsq|u|t[p1]); } } while( (u=*v++) != 128 ); } } Note that defines in diep : #define white 0 #define black 1 #define neutral 2 #define no_piece 0 /* 0b0000 */ #define pawn 1 /* 0b0001 */ #define knight 2 /* 0b0010 */ #define bishop 3 /* 0b0011 */ #define rook 4 /* 0b0100 */ #define queen 5 /* 0b0101 */ #define king 6 /* 0b0110 */ #define bpawn 9 /* 0b1001 */ #define bknight 10 /* 0b1010 */ #define bbishop 11 /* 0b1011 */ #define brook 12 /* 0b1100 */ #define bqueen 13 /* 0b1101 */ #define bking 14 /* 0b1110 */ The board array has 0,1,2 values. the snelbord array has values 0..14 (so not 2 for 'neutral'). The link define in diep is pretty primitive: #define Link(FFTT) {genindex->zet = FFTT;genindex++;} I try to avoid in my program: *p++ = value; If p is volatile that can cause parallel bugs. So making a habit out of it is a bad idea then i guess :)
This page took 0 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.