Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why have a UnMakeMove or UndoMove function (not as stupid as it sounds)?

Author: Angrim

Date: 15:14:18 02/24/03

Go up one level in this thread


On February 24, 2003 at 11:41:03, Albert Bertilsson wrote:

>Hello!
>
>I've done some testing and thinking and I ask the following question:
>Why have an UnMakeMove or UndoMove function?
>
>When testing with Sharper I found that actually copying the board and then
>calling DoMove on the new board was faster than using DoMove() / UndoMove() on
>the same board.
>
>My Board size is 376 bytes, and I figure that will cause a copy function to
>require some 94 copy instruction (on a 32 bit machine), this will of course also
>require some sort of condition of when to stop copying and so, but I figure this
>must be a much easier task than doing branches and testing if it was a capture
>etc. and updating piece lists.

I have a 148 byte board struct(for chess) and found that copy&modify was
at least 2x as fast as the fastest UnMake() that I could write.
We tend to think of memory access as being very slow, but modern
memory architecture is really optimized for copying large bocks of
sequential data, which is what a board copy is.  I just use the memcpy()
function, since the compiler knows about memcpy and inlines something
fast instead of actually doing a function call.

>Is this a unique case for me? Have anybody else tried it? What is your board
>size in bytes? Maybe this only works for me because my board is small (although
>I certainly don't think it is small).
>
>Regards Albert Bertilsson

I think your board size is rather large, but I expect that there are
people with boards many times as large as yours, and they would actually
be better off with UnMake().

Angrim



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.