Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Q: chess variant and board representation

Author: Uri Blass

Date: 21:36:36 01/16/03

Go up one level in this thread


On January 16, 2003 at 20:02:01, Edward Seid wrote:

>From what I've read about different board representations, 12x12 makes it easier
>to determine off-the-board knight moves, while 0x88 utilizes a shortcut to
>generate moves for sliding pieces.
>
>Consider a simple chess variant in which there are only pawns and no other
>pieces.
>
>It seems to me that neither of these representations would be applicable in a
>game with only pawns, and that the best representation would be a simple 8x8
>array.
>
>Does that make sense?

I use a different presentation in movei
I used originally two 64 squares array for piece and color in movei like tscp
but I changed it to one array

int info[64];
when I find the piece and the color by the following definition

#define piece(target) ((info[target])&7)
#define color(target) (((info[target])>>3)&3)

I have information about every square similiar to Rebel with the difference
that I have not the number 0,...12 for piece_type because with these numbers I
know no way to detect fast the piece or the color.

I still have info[square] for every square in the board for finding a piece or a
color but I have today a bigger array

int PADDED_info[80];
int * const info = PADDED_info+8;

I do not have a problem to determine off the board knight moves because I simply
have an array that I remember all the knight moves from every square.

My array is

int knightmove[64][8];

I have also 4 arrays for diagnol like leftdown[64] to determine the square that
is leftdown to a square and I need to check if this square is -1 that means that
I get out of the board.

Maybe there is a faster way to do it but I do not know it(for rooks it is faster
to have +8 or +1 but I cannot do it for bishops or pawns(otherwise they may go
from a2 to h3).

Note that for generating pawn moves that include captures I today do not use
arrays like leftdown arrays.

I believe that the following way is faster because the first condition usually
is false.
if ((color(square+9)==DARK)&&

Uri



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.