Computer Chess Club Archives


Search

Terms

Messages

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

Author: John R. Menke, Sr.

Date: 21:20:12 09/23/99

Go up one level in this thread


Brian,

It has been about 10-15 years, but I wrote some stuff in old-fashioned Commodore
64 Basic then translated it into assembly language.  At that time, it was the
best way I could devise. Compiled code was always a lot slower than assembled
code. I suppose compilers may be faster & better now using different languages
such as C, but I doubt that there is a better way!  So I would advise using a
higher (but compilable) language to write & debug the code, one with which you
are fluent and confident -- with the intention of doing a complete, manual
translation into assembly language as the final step in the process "someday".

If I recall correctly, I used a 10x10 byte array for the chessboard.  That's an
8x8 board with an extra two square border all around. I found it convenient for
my purposes. It allows for the knight jumps, which still land within the array.
Then you can have different 10x10 bit arrays (corresponding to the 10x10 byte
array) for different things that you want to evaluate, and you can and/or/eor
them in various intelligent ways.  At least that suffices to define the board
and legal chess moves.  I didn't get to the point of writing a move generator or
evaluator (chess engine).

--JRM



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.