michiguel wrote:Code: Select all
#if !defined(H_GTB) #define H_GTB /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ /* this includes a boolean type bool_t */ #include "bool_t.h" /* this includes SQUARE and SQ_CONTENT types */ #include "tbtypes.h"
Please inline content and avoid headers, I would like to see what are the types I am using here.
Why piece definitions and side to move and castling are not defined here (as enum, not as defines) ?michiguel wrote:Code: Select all
enum TB_return_values { tb_DRAW = 0, tb_WMATE = 1, tb_BMATE = 2, tb_FORBID = 3, tb_UNKNOWN = 7};
Why 5 init routines instead of one ?michiguel wrote:Code: Select all
/*----------------------------------*\ | Initialization | | Include somthing like this at | the beginning of the program. \*----------------------------------*/ tb_init(); tb_setcompression (1); tb_setpath ("/home/user/tb/"); tb_addpath ("/media/bigdisk/tb/"); tbcache_init (64*1024*1024 /* cache size 64M */, 32*1024 /* block size 32k */); tbcache_on();
It has a sense only if you foreseen the possibility to use the routines independently, and with different number of times, for instance you call tb_init() once and then call two times tb_setpath() duirng engine life time. Is is a possible secnario ?
Otherwise I suggest only _one_ init routine, it is more correct also from a theoretical point of view.
I don't know egbt internals, but this piece coding multiplexing it seems very slow and redundant. As a guide line I would try to avoid as much as possible positions transcoding, so that if internally your implementation uses an hash key to look up in the egbt table I woul prefer to pass directly that key instead of coding position in an array that will be decoded in a hash key (that is the functional entity) internally.michiguel wrote:Code: Select all
/*--------------------------------------*\ | | ASSIGNING POSITIONAL VALUES for | one probing example | | Position we try to probe: | | 1r6/6k1/8/8/8/8/1P6/1KR5 w - - 0 1 | \*--------------------------------------*/ stm = WHITE_TO_MOVE; /* 0 = white to move, 1 = black to move */ ep_square = NOSQUARE; /* no ep available */ castl = 0; /* No castling available */ ws[0] = B1; ws[1] = C1; ws[2] = B2; ws[3] = NOSQUARE; wp[0] = KING; wp[1] = ROOK; wp[2] = PAWN; wp[3] = NOPIECE; bs[0] = G7; bs[1] = B8; bs[2] = NOSQUARE; bp[0] = KING; bp[1] = ROOK; bp[2] = NOPIECE;
I suggest to post some beta versions and to promote to 1.0 only when API is stabilized (it will take time, be sure) because any variation of the API from that point on will require a major release change.michiguel wrote:Code: Select all
return EXIT_SUCCESS;