User Tools

Site Tools


public:gtql:gt-log_library

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:gtql:gt-log_library [2007/12/16 21:23] jonheidurpublic: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:gtql:logging_game_trees.rtf|}}
  
 Download the GT-Log Library here:  Download the GT-Log Library here: 
 {{public:gtql:loglibrary.rar|}} {{public:gtql:loglibrary.rar|}}
- 
-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/exiting a node. The 
-user collects the information he or she want to log in the structure data. 
- 
-/* Example TicTacToc program. */ 
-#include "gt_log.h" 
-... 
-GTDataDescript gtDataDescr = /* <= GTL data description */ 
-{ "TicTacToe", sizeof(Data_t), 0, {}, 5, 
-{ ... 
-{ "depth", offsetof(Data_t,depth), sizeof(int) }, 
-{ "best" , offsetof(Data_t,best), sizeof(int) }, 
-{ "type" , offsetof(Data_t,type), sizeof(int) } } 
-}; 
-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, moves); 
-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<=maxIter ; ++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( "TicTacToe", &gtDataDescr ); /* <= GTL new handle */ 
-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)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki