Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: piece list possibilities

Author: Roberto Waldteufel

Date: 02:50:40 07/10/98

Go up one level in this thread



On July 09, 1998 at 18:43:32, Robert Hyatt wrote:

>On July 09, 1998 at 17:14:02, Roberto Waldteufel wrote:
>
>>
>>On July 09, 1998 at 16:25:08, Bruce Moreland wrote:
>>
>>>
>>>On July 09, 1998 at 12:38:17, Robert Hyatt wrote:
>>>
>>>>On July 09, 1998 at 10:31:08, Dave Gomboc wrote:
>>>>
>>>>>On July 08, 1998 at 20:33:41, Bruce Moreland wrote:
>>>>>
>>>>>>
>>>>>>On July 08, 1998 at 17:27:41, Tom Kerrigan wrote:
>>>>>>
>>>>>>>My problem was that I invariably forgot about the dead-bit scheme and did all
>>>>>>>sorts of calculations assuming that captured pieces existed.
>>>>>>
>>>>>>The only place they exist is in the piece list, and unless you are somehow
>>>>>>randomly accessing your piece list, the only way you'll access this is via a
>>>>>>loop, so write the loop once and copy-paste :-)
>>>
>>>>>Why copy-paste?  What's wrong with a routine and an "inline this" compile
>>>>>directive?
>>>
>>>It'd be hard to inline just the "for" and an "if".  Sure, you could write an
>>>iterator function that took another function as a parameter, inline everything,
>>>and hope for the best, but I bet you wouldn't get the best every time.
>>>
>>>>two things.  (1) the "inline" attribute in a program only applies to
>>>>C++;  (2) you can only "suggest" that a C compiler inline a function.  Just
>>>>like you can "suggest" that a variable be kept in a register by using
>>>>"register int sq;".  But you can't force it to happen, and you might eat
>>>>a lot of function call overhead as a result...
>>>
>>>It is a suggestion in C++ as well.
>>>
>>>bruce
>>
>>OK, I'm going to stick my neck out and admit that I program in Basic - don't
>>laugh too loudly. One thing that is available in that language is the $include
>>directive, which includes the contents of a specified text file exactly as if it
>>were typed instead of the $include statement. The same text file can be included
>>in as many places as you like, so the kind of inline optimization discussed here
>>is easy to implement. My compiler also allows Basic and assembler code to be
>>freely intermixed, which is useful for speeding up critical parts of the code. I
>>don't know how well it would compare with C, however. Does anyone else use
>>anything but C to write chess programs?
>>
>>Best wishes,
>>Roberto
>
>
>yes, but from a software engineering point of view, this can be ugly,
>how would you like your search to look like this:
>
>$include init.c
>$include setup.c
>$include repetition_check.c
>$include hash_probe.c
>$include null_search.c
>$include move_generator.c
>for mv = 1 to num_moves do
>$include makemove.c
>$include recursive_search_call.c
>$include alpha_beta_test.c
>$include unmakemove.c
>done
>$include end_search.c
>return (value)
>
>
>That looks ugly.  and you can't tell what is going on without going to
>each of those include files...  and the include files are not procedures,
>they are like complete functions with lots of global state that is shared
>and would be a zoo to debug...


Hi Bob,

Yes, I agree that looks ugly, but it is not exactly what I had in mind. My
normal use of the $include option is quite sparing. Typically, I only use it
when I want to add some code that has to appear in identical, or almost
identical form in several places in the program, and then only if the new code
is sufficiently complicated that I think it might have bugs. Then I write the
new code in a separate file and $include it in the appropriate places, test the
program to see that it is working properly and compare performance to the
previous version before the change. If I end up making adjustments to the new
code I only have to change it in one place. When I am fully satisfied, I use the
cut/paste option to replace the $include statements with the actual code. I
don't just leave $include statements scattered all over the place like above.
They do aid in testing and debugging, but that's all.

Best Wishes,

Roberto



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.