Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: separate move functions?

Author: Sune Fischer

Date: 05:57:41 12/08/01

Go up one level in this thread


On December 08, 2001 at 08:10:42, Wylie Garvin wrote:

>On December 06, 2001 at 17:31:55, Sune Fischer wrote:
>
>>....
>>
>>I have special move functions for the pawns and kings, then I have one
>>makemove() for the rest. When the kings are done with the castling I switch so
>>the kings also uses the standard makemove(). It is only one "if" and a few local
>>variables I save, but I have a feeling that it is a bit faster to call the same
>>function often rather than dispersing the calls to many functions.
>>It is just a feeling, but why not make the switch when I already have the faster
>>function running.
>>
>
>Do you mind if I ask what representation you use for your generated moves?
>I use the bottom 13 bits of an int, with 6 bits of source and 6 bits of dest and
>1 "special" bit.  The first think my makemove does is test this special bit, and
>if clear it skips the checks for enpassant captures, castling moves and
>promotions.  This seems a lot simpler than having separate functions.
>?
>
>wylie

Sorry Wylie, didn't catch your post until now.

I know people say 1 integer is faster than a 4 chars, but this compact notation
with AND'ing and shifting is a bit over the top for me right now. I have enough
stuff to optimize and debug so I'm trying to keep the basic stuff simple.
One day I will of cause do an implementation to see if it is faster.

About my design for checking the castle and en-passent, then I put information
into the move struct about what kind of piece is doing the move, I use this for
calling the right move function. This way I don't have to check for EP or castle
if it is a rook, night, bishop or queen moving.

It is a complete pseudo-object orientated code, I never need to check for the
type of piece when finding its moves or when moving it.
In principle I could extend this so that every special move (like castle) had
its own move rutine, I would not need to check a thing.

I don't know exactly what the top programs' "move design" are.
But I hear most are written in C so I think they are doing similar stuff.

How are you doing it?

-S.



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.