Computer Chess Club Archives


Search

Terms

Messages

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

Author: Jari Huikari

Date: 04:53:05 09/24/99

Go up one level in this thread


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

>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 ??

Hi Brian! Good luck for programming chess!

I have used two-dimensional arrays of integers. (And one dimensional too)
Empty square's value = 0, white king = 1, black king = -1, white queen = 2,
and so on. And in some versions, when array was bigger than 64 squares the
value 100 for 'border', where it's not allowed to move in move generation.
And when using 8x8 array, I check that I don't try files or ranks lower
than 1 or greater than 8. All these have felt quite good for me. I have
used these representations, because they are simple!

>Second how long time does it take to make a basic engine! from scratch
>provided that i am a experienced programmer.

If you don't want to look for example program sourcecodes then
I suggest you to write first e.g. an engine with only kings and knights.
It won't take many hours, I guess. Then when it works, add bishops and
rooks. And then you can copy routines of bishops and rooks for queens.
Castlings and en passants may take more time.

If you don't necessarily want to write it all alone, you could look
some sourcecodes of some complete programs, and save a lot of time.
If you e.g. study the source code of Minimax, you could write your
program in couple of days, if you implement your program same way than it.

It'll be easier to first study some simple sourcecodes. (I made my first
chess programs in the harder way...)

					Jari



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.