Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Program in pure C

Author: Dann Corbit

Date: 13:45:38 03/19/02

Go up one level in this thread


On March 19, 2002 at 06:08:22, Sune Fischer wrote:

>On March 18, 2002 at 21:44:30, Dann Corbit wrote:
>
>>On March 18, 2002 at 21:40:41, pavel wrote:
>>
>>>need to get my hands on a basic chess program (with source code) written
>>>completely on C.
>>
>>Literally dozens of them.  I would recommend to start with TSCP.
>>Beowulf does not have a line of C++ in it.
>>
>>>Any out there?
>>>Also need to know, If I plan to write any program in C is it a great pain in the
>>>ass to tranfer it in to C++,
>>
>>Depends on the skill of the programmer and the original program.  It might be a
>>snap or it could be nearly impossible.
>>
>>>or even better, do I need to move in the long run?
>>
>>No.  If you want a C++ chess program, I would start with C++ to begin with.  The
>>C language is fine for chess.
>
>I've made a few of my old structs into classes, it is just easier to read when
>you don't have to begin every line with "board->...". I don't know if its
>faster, but I hope it isn't too much slower.
>
>I thought of a complete redesign with a super piece class and sub classes for
>each type, they could have their own MakeMove and RemovePiece which would save a
>few conditionals here and there. But since 80% of the makemove is identical for
>all the pieces, there would need to be a lot of identical code segments, which
>is clearly prone to error.

Well, there is always the "friend" or is that "fiend" function.

>I'm also afraid that with so many small functions being called, there would be a
>noticable overhead.

Most compilers will inline automatically if you ask them to.

>Maybe there is a better way to do it in C++?

There is always a better way.  Finding it is the hard part.  Amir Ban seems to
have done pretty well with Junior (which is C++ code).



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.