Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C or C++ for Chess Programming?

Author: Paul Byrne

Date: 23:05:54 08/17/00

Go up one level in this thread


On August 16, 2000 at 14:38:04, Severi Salminen wrote:

>Hi!
>
>Well, I have to say that yes, my assembly chess program played some chess (maybe
>at 1200 ELO...), but it was indeed hard to write and debug. Now I'm asking how
>does OOP (object oriented programming) suit for chess programming? Or should I
>forget the C++ standard and stick to the plain old C? Are there any efficiency
>aspects involved? I'm asking this because I'm quite new to OOP and would like to
>start studying it only if it benefits chess programming somehow. I'll be using
>the free Borland C++ 5.5
>
>Thanks for any advice!
>
>Severi

My C++ program plays a bunch of different chess variants and uses a bunch of
virtuals to handle the different rules.  I did a test a while back and changed
the benchmarking to use no virtual functions.  The result was less than 2%
faster (I'm using cygwin, by the way).  So, not a big deal there.

I also use exceptions to terminate searches.  I have no idea how much of a
slowdown this causes, but I doubt I'd change anyway.  Exceptions make this
so easy and flexible.

There's also a rather complicated template buried in there -- but that was more
of a programming exercise than a necessity.  :)

For me, the bottom line is that the resulting program is easier to work with,
perform horrible experiments on, etc.  And this more than makes up for any
slight slowdown.

-paul



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.