Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Promotion frequency

Author: Russell Reagan

Date: 12:52:39 07/23/02

Go up one level in this thread


On July 23, 2002 at 15:31:12, Sune Fischer wrote:

>>if (squares[i].piece().color() == BLACK)
>
>from a layman: doesn't look to me like that can be inlined, the compiler needs
>to know in advance what function to call to do that, but here color() depends on
>piece() which it won't know until runtime.

I'm not sure about that, because there aren't different piece classes based on a
base class Piece. piece() just returns a Piece object, so I think the color()
method is the only one, unless I misunderstand something about C++.

>BTW, you can do sq&1 to check the color of the square.

That's how I handle it internally. I'm beginning to think I should scrap this
whole OOP approach, but then I inevitably run into something that I want to
change and wish I had taken the OOP approach. Round and round I go...

Russell



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.