Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How do you represent chess boards in your chess programms

Author: Nicolas Carrasco

Date: 21:30:11 09/22/99

Go up one level in this thread


I recomend that if you won´t use bitboards, you should use 2 arrays of 64 ints.
One for the type of piece and the other for the color. Faile and TSCP are very
good programs that any newbie must study. It is more easy to use two arrays of
64 than one. Sould use other arrays for the move-generator.

I am not sure, but I think 2 arrays of 64 ints are faster than one for color and
type of piece.

int color[64];
int piece[64];

int init_color[64]= {
	1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1,
	6, 6, 6, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 6, 6,
	0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0
};



int init_piece[64]= {
	3, 1, 2, 4, 5, 2, 1, 3,
	0, 0, 0, 0, 0, 0, 0, 0,
	6, 6, 6, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 6, 6,
	6, 6, 6, 6, 6, 6, 6, 6,
	0, 0, 0, 0, 0, 0, 0, 0,
	3, 1, 2, 4, 5, 2, 1, 3
};

//////// FOR MOVE GENERATOR///////////////////////////////////////////
int mailbox[120]= {
	 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
	 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
	 -1,  0,  1,  2,  3,  4,  5,  6,  7, -1,
	 -1,  8,  9, 10, 11, 12, 13, 14, 15, -1,
	 -1, 16, 17, 18, 19, 20, 21, 22, 23, -1,
	 -1, 24, 25, 26, 27, 28, 29, 30, 31, -1,
	 -1, 32, 33, 34, 35, 36, 37, 38, 39, -1,
	 -1, 40, 41, 42, 43, 44, 45, 46, 47, -1,
	 -1, 48, 49, 50, 51, 52, 53, 54, 55, -1,
	 -1, 56, 57, 58, 59, 60, 61, 62, 63, -1,
	 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
	 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};

int mailbox64[64]= {
	21, 22, 23, 24, 25, 26, 27, 28,
	31, 32, 33, 34, 35, 36, 37, 38,
	41, 42, 43, 44, 45, 46, 47, 48,
	51, 52, 53, 54, 55, 56, 57, 58,
	61, 62, 63, 64, 65, 66, 67, 68,
	71, 72, 73, 74, 75, 76, 77, 78,
	81, 82, 83, 84, 85, 86, 87, 88,
	91, 92, 93, 94, 95, 96, 97, 98
};


On September 22, 1999 at 15:30:36, Brian Nielsen wrote:

>
>Hi
>
>My name is Brian, i was thinking about writing a chess engine for fun.
>I am pretty experienced programmer/developper(c++,delpie), but have not been
>programming games, thoug i have made a packman clone a couple years ago.
>
>I have done a little research myself to get the principles in making a chess
>engine/program, and i think i now have basic understanding in how to(i hope :-))
>
>i am curious in how you chessgame programmers represent the chessboard, I have
>seen 4-5 different examples/ways in how to do it, how do you do it and why ??
>
>Second how long time does it take to make a basic engine! from scratch
>provided that i am a experienced programmer.
>
>Best regards
>
>Brian Nielsen



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.