Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move structure

Author: Robert Hyatt

Date: 08:02:29 02/25/04

Go up one level in this thread


On February 25, 2004 at 08:17:03, Omid David Tabibi wrote:

>On February 24, 2004 at 20:38:06, Robert Hyatt wrote:
>
>>On February 24, 2004 at 17:17:09, Omid David Tabibi wrote:
>>
>>>On February 23, 2004 at 16:11:38, Russell Reagan wrote:
>>>
>>>>On February 23, 2004 at 10:51:54, Omid David Tabibi wrote:
>>>>
>>>>>The question is, was it worth the time to do the change? Wouldn't it be better
>>>>>to spend the time parallelizing Tiger (i.e., Deep Tiger)?
>>>>>
>>>>>I have 32 bits for move, and changing it to 16 bits is in my todo queue for a
>>>>>long time (more than a year). But there are always more important things to do.
>>>>
>>>>Surely you didn't put 'unsigned long' all over your program did you? :) Using a
>>>>typedef makes this a one line change:
>>>>
>>>>typedef unsigned long MoveType;
>>>>
>>>>to...
>>>>
>>>>typedef unsigned short MoveType;
>>>
>>>It is not just changing the 'int' to 'short'. It is a whole mess of changing all
>>>the routines that access those 32 bit moves and change them all so that now they
>>>would correctly access the 16 bit moves.
>>>
>>>But even after doing that, the benefit will be negligible.
>>
>>Think encapsulation.
>>
>>In C, that can be done by using macros to access things that might change, so
>>that you change the macro, and recompile everything and away you go...
>
>I know, but too late to introduce those macros now, especially when no
>significant performance boost will be achieved :)
>
>I have many macros, but the last thing I thought about was to add macros for
>accessing the move structure...

Macros like From(), To(), Piece(), Type(), Promote(), Captured() are easy to
add, even without using them.  Then as you run across places where you use the
rank or file or from or to or whatever, you can replace them slowly over time.
I have a large number of macros to attempt to make the program more readable, as
well as easier to work on...

Not every decision is based on performance only...


>
>>
>>
>>>
>>>>
>>>>I have recently taken up stuffing everything into a class so I can make these
>>>>kinds of changes very quickly and see what works best. There are other
>>>>advantages too, at neglibile (if any) run-time speed penalties. I could switch
>>>>between 16-bits, 32-bits, or a struct, and make only trivial changes to a few
>>>>lines of code.
>>>>
>>>>Even if you're using C and have no classes, it will probably be very beneficial
>>>>to touch the actual data as little as possible, using typedefs and macros or
>>>>inline functions instead.



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.