public:gtql:gt-log_library
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| public:gtql:gt-log_library [2007/12/16 21:23] – jonheidur | public:gtql:gt-log_library [2024/04/29 13:33] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| The Log library can be used in game-playing programs and other search programs to log search trees to file. | The Log library can be used in game-playing programs and other search programs to log search trees to file. | ||
| + | |||
| + | Example of usage can be found here: | ||
| + | {{public: | ||
| Download the GT-Log Library here: | Download the GT-Log Library here: | ||
| {{public: | {{public: | ||
| - | |||
| - | Below is an example to show how to use the game-tree log interface in a game program. We | ||
| - | use here a simple iterative deepening and minimax procedure for demonstration purposes | ||
| - | (and omit various details that are not relevant for our demonstration purposes). Essentially, | ||
| - | one must create a handle in the beginning (and delete in the end), open a new file | ||
| - | for each search iteration, and call special functions when entering/ | ||
| - | user collects the information he or she want to log in the structure data. | ||
| - | |||
| - | /* Example TicTacToc program. */ | ||
| - | #include " | ||
| - | ... | ||
| - | GTDataDescript gtDataDescr = /* <= GTL data description */ | ||
| - | { " | ||
| - | { ... | ||
| - | { " | ||
| - | { " | ||
| - | { " | ||
| - | }; | ||
| - | GTLogHdl hGTL; /* <= Game-tree log handle. */ | ||
| - | Value Minimax( Position_t *pos, int depth, Move_t move_last ) { | ||
| - | Data_t data; /* <= GTL data record, user defined. */ | ||
| - | ... | ||
| - | data.depth = depth; | ||
| - | gtl_enterNode( hGTL, move_last ); /* <= GTL enter node.*/ | ||
| - | ... | ||
| - | n = generateMoves(pos, | ||
| - | for ( i=0 ; i<n ; i++ ) { | ||
| - | makeMove( pos, moves[i] ); | ||
| - | value = -Minimax( pos, depth-1, moves[i] ); | ||
| - | ... | ||
| - | retractMove( pos, moves[i] ); | ||
| - | } | ||
| - | ... | ||
| - | data.best = best; | ||
| - | gtl_exitNode( hGTL, &data ); /* <= GTL exit node */ | ||
| - | 49 | ||
| - | return best; | ||
| - | } | ||
| - | Value IterativeDeepening( ... ) { | ||
| - | ... | ||
| - | for ( iter=1 ; iter< | ||
| - | ... | ||
| - | gtl_startTree( hGTL, filename, strFEN ); /* <= GTL open new game-tree log file */ | ||
| - | ... | ||
| - | value = Minimax( &pos, iter, NULL_MOVE ); | ||
| - | ... | ||
| - | gtl_stopTree( hGTL ); /* <= GTL close tree */ | ||
| - | } | ||
| - | ... | ||
| - | } | ||
| - | int main() { | ||
| - | ... | ||
| - | hGTL = gtl_newHdl( " | ||
| - | if ( hGTL == NULL ) exit(EXIT_FAILURE); | ||
| - | ... | ||
| - | gtl_deleteHdl( &hGTL ); /* <= GTL delete handle */ | ||
| - | ... | ||
| - | } | ||
/var/www/cadia.ru.is/wiki/data/attic/public/gtql/gt-log_library.1197840207.txt.gz · Last modified: 2024/04/29 13:32 (external edit)