Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: piece list possibilities

Author: Don Dailey

Date: 10:39:34 07/11/98

Go up one level in this thread


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

There is no magic language you should use to write chess programs.  The
advantages of C are that the compilers are quite good and C is widely
available in many platforms.  Basic may be quite good too, I don't
really know but I suspect the good compiler technology exists for
basic also so I don't see why not.   The #include "filename" works
just fine in C and probably other languages as well.

My own personal opinion is that most languages will work and it should
be possible to write a very strong program in them.  However you cannot
expect an interpreted language to work well because of the speed.
So compiled Basic, Pascal, C and others should be fine.
Rexchess was written in assembly with a little Pascal mixed in.

I do think you might have a small edge in using C since it's usually
cutting edge and often considered the language of choice for fast
efficient optimizations.   If you are adding assembly code (and doing
it well) there may little or no difference however.

I think it is more important to be happy with the language you are
using and feeling productive and comfortable with it.

- Don



This page took 0.01 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.