Computer Chess Club Archives


Search

Terms

Messages

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

Author: Roy Eassa

Date: 15:41:01 11/17/02

Go up one level in this thread


On November 17, 2002 at 16:21:24, Bob Durrett wrote:

>On November 17, 2002 at 16:10:02, Roy Eassa wrote:
>
>>On November 16, 2002 at 12:23:49, Bob Durrett wrote:
>>
>>>On November 16, 2002 at 12:01:01, José Carlos 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 years 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.
>>>>
>>>>  Most (if not all) C++ copilers are also C compilers. Visual C++ is.
>>>>  What languaje to choose is a matter of personal preference, because both are
>>>>equally good for chess programming.
>>>
>>>I wanted to be able to study Crafty and understand that Bob Hyatt programmed it
>>>in C and not C++.  Similarly, the thesis on chess engines I'm looking at used C
>>>and not C++.  The book I ordered on chess engines may be written in C too, I
>>>don't know.
>>>
>>>Well, all my gyrations are for nothing because I just looked at my bookcase at
>>>home and found a book [with a CD] titled "Teach Yourself C in 24 Hours" by Tony
>>>Zhang, SAMS Publishing, Copyright 1997.  It's for Windows 95.  Maybe the
>>>compiler on the CD will run on my Windows 98 machine.
>>>
>>>Oddly enough, the author says he compiled all the C programs using Microsoft
>>>Visual C++ version 1.5.  Odd that he uses a Visual C++ compiler to compile a
>>>program written in the C language, but I guess that's what makes programming
>>>interesting?
>>>
>>>I guess I'll be up to speed on C in 24 hours?
>>>
>>
>>
>>It's probably not the *best* book out there, but it's also probably adequate.
>>
>>You will find that programming is incredibly time-consuming and can be very
>>frustrating.  But it's fun when you start to create real stuff.  I wouldn't
>>start with something so complex as Crafty -- it might make more sense to start
>>with a very simple and stripped-down chess program for which you can obtain
>>well-commented source code.  (Of course, this would still be AFTER you learned
>>how to program and did many simple programs along the way.)
>>
>>One other thought: you could use BASIC.  It's easier to learn and more oriented
>>towards beginners.  And I think there are a least 1 or 2 chess programs written
>>in BASIC for which you can get the source code.  Microsoft's Visual Basic is the
>>most popular BASIC environment, but there are others including some free ones.
>>Any chess program in BASIC will of course be relatively slow and thus weaker,
>>but your goal probably should be more oriented towards learning, and tackling C
>>without a teacher/mentor can be quite difficult (especially when things don't
>>work -- or crash -- and you don't know why).  You'll still have plenty of
>>hurdles learning BASIC and progamming something in it!  And nowadays you can do
>>significant projects in that language.
>
>Well, I may have an old Visual Basic compiler laying around.  But, to be honest,
>I didn't like basic because it is too "basic."
>
>Until about twenty years ago, I did a lot of Fortran programming.  I don't know
>if Fortran is close to C or not, but would hate to take a 1 year detour before I
>got into C.  : )
>
>Bob D.


If you have some programming background, then yes, I'd skip BASIC and go for C.
And I do think there are aspects of C that are like Fortran.  Did you ever
happen to use Algol or Pascal?  They share more aspects with C than does Fortran
(e.g., block-structured coding).

My comment about using BASIC was based on the idea that if one sets one's sights
too high, one may become frustrated and quit.  In that case, BASIC wouldn't be a
detour but a stepping stone.  (And it would probably be more like a 3-month
detour than a year, assuming you spend at least a few hours a week on it.)

Anyway, the best of luck to you!


>>
>>
>>
>>>Bob D.
>>>
>>>[2nd Childhood, for sure!]
>>>
>>>
>>>>  C is conceptually easier to learn. With C++ you can write conceptually more
>>>>complex programs with less complexity for you. Chess is simple enough for making
>>>>C++ conceptual advantage not important.
>>>>  If you don't know any of both, just chose one (I'd suggest C because I like it
>>>>more, but no objective reason) and learn it. Only after you know the languaje,
>>>>start doing chess programming. If you start too soon, you'll get confused and
>>>>lose motivation.
>>>>  My 2 cents.
>>>>
>>>>  José C.



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.