DoubleCheck 2.3 is out

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: DoubleCheck 2.3 is out

Post by zullil »

ZirconiumX wrote:Just get a few warnings on OSX with an ancient gcc (4.0.1):

Code: Select all

$ gcc -O3 -DPOSIX -DNDEBUG -I/./*.h ./*.c -std=c99 -o doublecheck
./search.c:49: warning: 'adjust_tt_score' declared inline after being called
./search.c:49: warning: previous declaration of 'adjust_tt_score' was here
./search.c:48: warning: 'can_return_tt' declared inline after being called
./search.c:48: warning: previous declaration of 'can_return_tt' was here
./search.c:47: warning: 'update_killers' declared inline after being called
./search.c:47: warning: previous declaration of 'update_killers' was here
Here's what I see using gcc (4.6.2):

Code: Select all

LZsMacPro-OSX6: ~/Downloads/DoubleCheck_23/src] gcc-mp-4.6 -O3 -DPOSIX -DNDEBUG -Wall -I/./*.h ./*.c -std=c99 -o DoubleCheck2.3
./search.c:391:13: warning: 'alpha_beta_ok' defined but not used [-Wunused-function]
lucasart
Posts: 3241
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: DoubleCheck 2.3 is out

Post by lucasart »

Just get a few warnings on OSX with an ancient gcc (4.0.1):

Code: Select all

$ gcc -O3 -DPOSIX -DNDEBUG -I/./*.h ./*.c -std=c99 -o doublecheck
./search.c:49: warning: 'adjust_tt_score' declared inline after being called
./search.c:49: warning: previous declaration of 'adjust_tt_score' was here
./search.c:48: warning: 'can_return_tt' declared inline after being called
./search.c:48: warning: previous declaration of 'can_return_tt' was here
./search.c:47: warning: 'update_killers' declared inline after being called
./search.c:47: warning: previous declaration of 'update_killers' was here
I would say gcc 4.0.1 is at fault here.
Here's what I see using gcc (4.6.2):

Code: Select all

LZsMacPro-OSX6: ~/Downloads/DoubleCheck_23/src] gcc-mp-4.6 -O3 -DPOSIX -DNDEBUG -Wall -I/./*.h ./*.c -std=c99 -o DoubleCheck2.3
./search.c:391:13: warning: 'alpha_beta_ok' defined but not used [-Wunused-function]
Yes, that's a pretty stupid warning. Obviously I have functions here and there, that are only used for debugging (only referenced in assert() statements). And there is no reason for the compiler to complain, since they will be removed at linking time.

I will enclose them in a:

Code: Select all

#ifndef NDEBUG
... debug only code...
#endif
to silence the warning anyway. I get this warning too actually (I'm using GCC 4.6).

PS: you don't need the "-I/./*.h", because all the h files are approprietly included by the c files.
lucasart
Posts: 3241
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: DoubleCheck 2.3 is out

Post by lucasart »

ZirconiumX wrote: Also, do I dare see someone breaking the UCI rules?!
UCI specs wrote: Move format:
------------

The move format is in long algebraic notation.
A nullmove from the Engine to the GUI should be send as 0000.
Examples: e2e4, e7e5, e1g1 (white short castling), e7e8q (for promotion)
DC output wrote: info score cp 83 depth 11 nodes 246624 time 1720 pv Rc5d5 Rd1xd5 e6xd5 Nc4b2 d5d4 Qa1c1 d4xe3 f2xe3 Bb7e4
Matthew:out
Ah, you're right. I did that because I mainly use my engine in command line, so I see things better this way. Fortunately for me, the UCI interface that I use, cutechess-cli, understands my move format. But yes, it's best to comply with the standard, since other interfaces may not be so kind as cutechess-cli!

The good news however, is that it's a trivial code fix:just replace "true" by "false" in the function print_pv defined in search.c:

Code: Select all

static void print_pv(Board *B, SearchInfo *si)
{
	char s[16];
	move_t pv[MAX_PLY];
	int pv_length = get_pv(B, pv);

	printf("pv");

	for (int i = 0; i < pv_length; i++) {
		move_to_string(B, pv[i], s, false);
		printf(" %s", s);
	}
	printf("\n");
}
lucasart
Posts: 3241
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: DoubleCheck 2.3 is out

Post by lucasart »

ZirconiumX wrote: Seriously though, brilliant engine, it is lightning fast!
Actually it's quite slow (in nodes per second), given the little it calculates: the eval is still very basic. But I'd rather fix more important things before I start making the code obfuscated to improve the raw speed.
ZirconiumX
Posts: 1346
Joined: Sun Jul 17, 2011 11:14 am
Full name: Hannah Ravensloft

Re: DoubleCheck 2.3 is out

Post by ZirconiumX »

Good that the fix is easy - Sigma Chess gives PV as -...

I'm currently recompiling DC.

Hmmm...

Code: Select all

matthew$ gcc -O3 -DPOSIX -DNDEBUG -I/./*.h ./*.c -std=c99 -o doublecheck -Wall -pedantic
In file included from ./search.h:17,
                 from ./main.c:16:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
./main.c: In function 'main':
./main.c:31: warning: ISO C does not support the 'q' printf length modifier
./move.c: In function 'string_to_move':
./move.c:43: warning: 'm.check' is used uninitialized in this function
./move.c:43: warning: 'm.promotion' is used uninitialized in this function
./move.c:43: warning: 'm.ep' is used uninitialized in this function
./movegen.c: In function 'gen_castling':
./movegen.c:145: warning: 'm.check' is used uninitialized in this function
./movegen.c: In function 'gen_quiet_checks':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_piece_moves':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_pawn_moves':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_evasion':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_moves':
./movegen.c:145: warning: 'm.check' is used uninitialized in this function
In file included from ./search.h:17,
                 from ./search.c:15:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
./search.c: In function 'id_loop':
./search.c:82: warning: ISO C does not support the 'q' printf length modifier
./search.c: At top level:
./search.c:49: warning: 'adjust_tt_score' declared inline after being called
./search.c:49: warning: previous declaration of 'adjust_tt_score' was here
./search.c:48: warning: 'can_return_tt' declared inline after being called
./search.c:48: warning: previous declaration of 'can_return_tt' was here
./search.c:47: warning: 'update_killers' declared inline after being called
./search.c:47: warning: previous declaration of 'update_killers' was here
./search.c:392: warning: 'alpha_beta_ok' defined but not used
In file included from ./tt.c:15:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
In file included from ./search.h:17,
                 from ./uci.c:16:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
./uci.c: In function 'loop_step':
./uci.c:88: warning: ISO C does not support the 'q' printf length modifier
Better fix those bugs! (No errors though)

You still haven't fixed it:
Naughty DC wrote: info currmove Qd8xd1+ currmovenumber 54
Matthew:out
tu ne cede malis, sed contra audentior ito
lucasart
Posts: 3241
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: DoubleCheck 2.3 is out

Post by lucasart »

ZirconiumX wrote:Good that the fix is easy - Sigma Chess gives PV as -...

I'm currently recompiling DC.

Hmmm...

Code: Select all

matthew$ gcc -O3 -DPOSIX -DNDEBUG -I/./*.h ./*.c -std=c99 -o doublecheck -Wall -pedantic
In file included from ./search.h:17,
                 from ./main.c:16:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
./main.c: In function 'main':
./main.c:31: warning: ISO C does not support the 'q' printf length modifier
./move.c: In function 'string_to_move':
./move.c:43: warning: 'm.check' is used uninitialized in this function
./move.c:43: warning: 'm.promotion' is used uninitialized in this function
./move.c:43: warning: 'm.ep' is used uninitialized in this function
./movegen.c: In function 'gen_castling':
./movegen.c:145: warning: 'm.check' is used uninitialized in this function
./movegen.c: In function 'gen_quiet_checks':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_piece_moves':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_pawn_moves':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_evasion':
./movegen.c:37: warning: 'm.check' is used uninitialized in this function
./movegen.c:32: warning: 'm.ep' may be used uninitialized in this function
./movegen.c:32: warning: 'm.promotion' may be used uninitialized in this function
./movegen.c: In function 'gen_moves':
./movegen.c:145: warning: 'm.check' is used uninitialized in this function
In file included from ./search.h:17,
                 from ./search.c:15:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
./search.c: In function 'id_loop':
./search.c:82: warning: ISO C does not support the 'q' printf length modifier
./search.c: At top level:
./search.c:49: warning: 'adjust_tt_score' declared inline after being called
./search.c:49: warning: previous declaration of 'adjust_tt_score' was here
./search.c:48: warning: 'can_return_tt' declared inline after being called
./search.c:48: warning: previous declaration of 'can_return_tt' was here
./search.c:47: warning: 'update_killers' declared inline after being called
./search.c:47: warning: previous declaration of 'update_killers' was here
./search.c:392: warning: 'alpha_beta_ok' defined but not used
In file included from ./tt.c:15:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
In file included from ./search.h:17,
                 from ./uci.c:16:
./tt.h:22: warning: type of bit-field 'depth' is a GCC extension
./tt.h:23: warning: type of bit-field 'key56' is a GCC extension
./uci.c: In function 'loop_step':
./uci.c:88: warning: ISO C does not support the 'q' printf length modifier
Better fix those bugs! (No errors though)

You still haven't fixed it:
Naughty DC wrote: info currmove Qd8xd1+ currmovenumber 54
Matthew:out
That's rather strange. I just compiled it with the "-pedantic" flag and got only the GCC extension warnings. Seems your version of GCC is more "pedantic" than mine ;-)

Code: Select all

lucas@megatron:~/Chess/DoubleCheck$ make
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o bitboard.o bitboard.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o board.o board.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o eval.o eval.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o magic.o magic.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o main.o main.c
In file included from search.h:17:0,
                 from main.c:16:
tt.h:22:2: warning: type of bit-field ‘depth’ is a GCC extension [-pedantic]
tt.h:23:2: warning: type of bit-field ‘key54’ is a GCC extension [-pedantic]
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o move.o move.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o movegen.o movegen.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o movesort.o movesort.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o psq.o psq.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o search.o search.c
In file included from search.h:17:0,
                 from search.c:15:
tt.h:22:2: warning: type of bit-field ‘depth’ is a GCC extension [-pedantic]
tt.h:23:2: warning: type of bit-field ‘key54’ is a GCC extension [-pedantic]
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o tt.o tt.c
In file included from tt.c:15:0:
tt.h:22:2: warning: type of bit-field ‘depth’ is a GCC extension [-pedantic]
tt.h:23:2: warning: type of bit-field ‘key54’ is a GCC extension [-pedantic]
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o uci.o uci.c
In file included from search.h:17:0,
                 from uci.c:16:
tt.h:22:2: warning: type of bit-field ‘depth’ is a GCC extension [-pedantic]
tt.h:23:2: warning: type of bit-field ‘key54’ is a GCC extension [-pedantic]
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o uci_option.o uci_option.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o util.o util.c
gcc -O3 -std=c99 -DPOSIX -DNDEBUG -Wall -pedantic   -c -o zobrist.o zobrist.c
gcc -flto bitboard.o board.o eval.o magic.o main.o move.o movegen.o movesort.o psq.o search.o tt.o uci.o uci_option.o util.o zobrist.o -o DC
Unfortunately these GCC extensions are extremely important and I don't want to code without.

All the uninitialized stuff is actually OK and intentional. For example the flag move_t.check is not computed by the move generation machinery, but later when moves are "picked" by the move sorting stuff, I test whether they give check and even revealed check and flag the move at this point.

I did a full perft check on lots of positions at different depth to make sure it was 100% bug-free. But I could probably silence these warnings with a few trivial code modifications (with a negligible run time cost).

As for the PV, there is another "true" to set to "false". Good spot (again search.c)

Code: Select all

		// root node, display move to search
		if (!ply && node_count >= 0x1000) {
			char s[16];
			move_to_string(B, ms->m, s, false);
			printf("info currmove %s currmovenumber %d\n", s, msl.idx);
		}