Author: Axel Grüttner
Date: 05:10:47 02/20/03
I´m programming my first Move Generator using a 10x12 Board.
1)The main structure is somthing like this:
for(i=A1;i<=H8; i++){
switch(BOARD[i]){
case KNIGHT: ...(make moves)
case PAWN : ...
...}
}
is this construct ok? or are there any better models which are simply to
implement?
2)First I used for KNIGHT moves a offset-array Koffset={-21,-19,..., 21}
and implemented it :
case KNIGHT: {
for(j=0; j<8; j++){
if(BOARD[i+Koffset[j]]==EMPTY)
_make move_
}
But testing with 8 seperate IF´s
case KNIGHT: {
if(BOARD[i-21]==EMPTY){_make move_}
if(BOARD[i-12]==EMPTY){_make move_}
...
if(BOARD[i+21]==EMPTY){_make move_} }
and without such an Offset-array was much faster. is this because of the LOOP,
or because of everlasting dereferencing the offset
3)because of the performance lag, using a loop, i´ve got no idea to realize the
move generation for the bishop and rook with no use of any LOOP. are the any
alternatives?
thx axel
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.