Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: I'm Confused. C, C++, C#. Which to Use?

Author: Anthony Cozzie

Date: 13:28:14 11/16/02

Go up one level in this thread


On November 16, 2002 at 13:16:33, Bob Durrett wrote:

>On November 16, 2002 at 12:29:35, Peter Skinner wrote:
>
>>On November 16, 2002 at 11:45:27, Bob Durrett wrote:
>>
>>>
>>>I'm Confused.  C, C++, C#.  Which to Use?
>>>
>>>I have an old Visual C++ compiler which I purchased many ago.  But bulletins
>>>posted here seem to favor C, as opposed to C++ as if C is better than C++ for
>>>chess engine programming.
>>>
>>>Still trying to find the best C compiler to use for chess engine design on my
>>>Compaq 1 GHz 1GB RAM single-processor PC.
>>>
>>>Tried to download one but got error message saying NO!
>>>
>>>Yahoo! seems to find C++ compilers but not C compilers.
>>>
>>>Sorry for sounding like a child.  : (
>>>
>>>Bob D.
>>
>>About 2 to 3 years ago I wanted to write a program as well. Since I had no clue
>>where to start I based my engine off the GNUChess 4 source. I was learning C the
>>same time so it was nice to have a code to start off of.
>>
>>After 3 years I would never try to start from scratch. There are two main
>>reasons:
>>
>>1. I am not a very skilled programmer. I can implement things, but I ask a
>>million questions like yourself, and there is nothing wrong with that. People
>>here are great with answering questions. The answers I have recieved through
>>this board and the Crafty mailing list have helped immensely.
>>
>>2. Time. I don't have much time to program. Starting an engine from scratch
>>takes an incrdible amount of time. I would suggest that you look at some sources
>>to understand the different structures that Gerbil, Crafty, GnuChess anything
>>that has published source code. That helped me quite a bit. Those authors who
>>_have_ put the time in to start from scratch give the code out for people to
>>learn from and I am grateful.
>>
>>Personally if you want to write an engine, I would start in C. Most compiler
>>that are for C++ are C complilers anyway. I prefer the Visual Studio from MS as
>>the MSDN library has some great code examples to look at.
>>
>>That's my two cents.
>>
>>Peter.
>
>Thanks.  The Microsoft Visual Studio's System Requirements seem to exclude
>Windows 98, which is what I have.  Guess I'll have to buy a new $5000 chess
>computer.  Convincing my wife is going to be a problem.  I wonder if Visual
>Studio will run on a dual or quad processor machine?  Anyway, I'm just joking.
>Maybe I don't need Visual Studio today after all.  A pity, though.  But . . . so
>be it.
>
>Bob D.

My experience: I became interested in chess at about 11th grade, which was the
same time I learned to program in C.  I of course tried to write a program to
play chess.  Result: zip.  I tried again during my freshman year of college.
Result: a move generator capable of generating 10,000 moves/second.  Went back
to college.  After my sophmore year, I tried again.  This time I actually read
up on what other people, and I wrote an engine that actually did play chess
(rating about 1600).  I actually precomputed stuff for the move generation, and
did some other things.  Unfortunately I had massive transposition table and
quiescence search bugs.  Finally, after my junior year I started from scratch
(again, sigh) using bitboards.  I wrote a static exchange evaluator, which did
wonders for my Q search. Result: zappa.  Even during zappa's creation, I have
rewritten parts from scratch (3 tries at the move generator, for example).

The point is, writing a chess engine is *hard*.  Writing a chess engine without
knowing how to program in some language is nearly impossible.  I would recommend
you take a C programming class (learn the basics of syntax) and a 2nd semester
freshman CS class (learn basic algorithms and datastructures, approaches, and
get a general idea of "what is a good program, and what is a bad program").
You are like a man trying to play hockey without knowing how to skate.  Basics
Basics Basics :)



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.