Moderator: Andres Valverde
if (p->board_piece[i]==1){p->board_adress[i]=j;p->pieces[j]=i;j++;continue;}
if (p->board_piece[i]==1)
{
p->board_adress[i]=j;
p->pieces[j]=i;
j++;
continue;
}
Roman Hartmann wrote:Hi Uri,
counting lines is tricky as some people (including me) prefer to have several statements on a line. At least as long as the code remains somehow readable.
- Code: Select all
if (p->board_piece[i]==1){p->board_adress[i]=j;p->pieces[j]=i;j++;continue;}
- Code: Select all
if (p->board_piece[i]==1)
{
p->board_adress[i]=j;
p->pieces[j]=i;
j++;
continue;
}
maybe the sources should be formatted with indent before counting lines.
int Foo[64];
inline int foo(Square s) {
return Foo[s];
}
Tord Romstad wrote:Glaurung 2 currently has 16888 lines of code, while Glaurung 1.2.1 has 7021 lines. I am quite sure Glaurung 2 is still a lot bigger if you look at characters, tokens, non-comment lines, compressed source code, or any other simple and precisely defined way of measuring code size. Nevertheless, on a conceptual level, I think Glaurung 2 is a simpler and more compact program.
Zach Wegner wrote:What I'm getting at is that I'm surprised you have so many lines.
If hadn't ever seen your coding style, I would think you would have a very small program.
But somehow you have managed in the same time frame to write two very strong engines, far above my level. Maybe I just wasted too much time on move generation and DTS search?
P.S. How big was Gothmog?
void foo(void) {
while(bar()) {
if(baz()) {
for(int i = 0; i < 10; i++) {
gazonk(i); }}}}
Tord Romstad wrote:Why? If you hadn't ever seen my coding style, I don't see how you could have a well-informed guess about the size of my program.
Of course. I have had a lot of fun with the bitboard approaches. DTS, I don't know. However, I have always wanted a strong program, but for some reason it is hard for me.It's never a waste of time. We are both amateurs and do this just for fun, and we should just enjoy what we are doing without worrying if other approaches could have led to faster progress.
Tord Romstad wrote:As another example, Glaurung 1 and Glaurung 2 both use a bitbase for the endgame KP vs K. In Glaurung 1, this bitbase is read from binary file on disk. In Glaurung 2, the bitbase is computed from scratch during program initialization (in a very inefficient and stupid way). This tiny difference alone adds more than 300 lines of code to Glaurung 2 compared to Glaurung 1, but I don't think it makes Glaurung 2 "bigger" in any meaningful sense of the word.
Tord
bob wrote:Why a bitbase for KPK? The rules for that ending are trivial to implement as per Reuben Fine's book...
bob wrote:Tord Romstad wrote:As another example, Glaurung 1 and Glaurung 2 both use a bitbase for the endgame KP vs K. In Glaurung 1, this bitbase is read from binary file on disk. In Glaurung 2, the bitbase is computed from scratch during program initialization (in a very inefficient and stupid way). This tiny difference alone adds more than 300 lines of code to Glaurung 2 compared to Glaurung 1, but I don't think it makes Glaurung 2 "bigger" in any meaningful sense of the word.
Tord
Why a bitbase for KPK? The rules for that ending are trivial to implement as per Reuben Fine's book...
Harald Johnsen wrote:bob wrote:Why a bitbase for KPK? The rules for that ending are trivial to implement as per Reuben Fine's book...
Really ? What are this rules anyway, how to do evaluate a position where the kings are not on the key squares ?
Anyway accessing a bitbase is 4 lines of code so it will allways be simpler than any coded rules.
HJ.
Return to Programming and Technical Discussions
Users browsing this forum: No registered users and 6 guests