Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Any reason to use C?

Author: Bo Persson

Date: 07:24:33 07/30/03

Go up one level in this thread


On July 30, 2003 at 07:43:51, Ricardo Gibert wrote:

>On July 30, 2003 at 03:51:35, Bo Persson wrote:
>
>>
>>The Piece class is of course just a wrapper around your int or enum. Using lots
>>of small inlined functions, you can get (at least) the same speed as with C,
>>while making the code much more readable.
>>
>>I very much prefer code like
>>
>>if (Piece.isKing())
>>if (Piece.isBlack())
>>
>>over
>>
>>if (Piece & KING_MASK)
>>if (!(Piece & COLOR_MASK))
>
>
>Why not compare with the following instead?
>
>if (isKing(Piece))
>if (isBlack(Piece))
>

I really don't like it just as much, it's more like the reverse Polish notation
on HP calculators. Didn't like them either. :-)

And then, in C++ I can also write

if (Square.isBlack())
if (Piece.isBlack())
if (CurrentPlayer().isBlack())

or

if (NextMove.CapturedPiece().isKing())


I like to be able to get the abstraction up to this level. Just a matter of
taste, of course.


Bo Persson
bop2@telia.com



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.