Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Position representation

Author: Dann Corbit

Date: 10:20:38 01/21/02

Go up one level in this thread


On January 21, 2002 at 11:52:28, Russell Reagan wrote:

>I'm thinking about using different position representation in my program.
>Currently I have a 64 byte array for the squares and a few other variables for
>side to move and the rest. I contemplated going to a 256 byte array (16x16) and
>using a 2 row border around the 8x8 board.
>
>This seemed like it would help speed up and make easier the edge detection, but
>then I began to think about other areas of my program, such as simply looping
>through the board. Before I just used a for loop from 0 to 63, but with a 16x16
>board you'd have to do a column increment and a row increment with a multiply or
>an addition of the width of the board, so it seems that in that area it might be
>slower. I've thought of several other fixes for each of these methods and each
>one has areas where it seems a little faster and another area where it would be
>slower. Anyone have any advice as far as chess position representation, or
>simply how to approach these kinds of problems?

One way to do it is just have an 8x8 board that sits in the middle of a larger
array (IOW, you allocate or declare a bigger array, and then have a pointer to
your smaller array that you initialize to point to the interior of the larger
array).  That way, you can calculate array offsets that are negative numbers
without actually invoking undefined behavior.  Things that are off the board
(like knight attacks on the edge, for instance) would just be attacks into the
outer array and still in user data space.

>Also, does anyone know how to view the C/C++ with ASM view in MSVC++? I've
>reached a view in the program before where it had the C/C++ statement, then the
>ASM below it, but I can't figure out how I got to this anymore.

Right mouse click -- go to disassembly.
To get back to source:
Right mouse click -- go to source.



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.