00001 //---------------------------------------------------------------------------- 00002 /** @file HexUctUtil.hpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef HEXUCTUTIL_H 00007 #define HEXUCTUTIL_H 00008 00009 #include "SgBlackWhite.h" 00010 #include "SgPoint.h" 00011 #include "SgUctSearch.h" 00012 00013 #include "StoneBoard.hpp" 00014 00015 _BEGIN_BENZENE_NAMESPACE_ 00016 00017 //---------------------------------------------------------------------------- 00018 00019 /** General utility functions used in GoUct. 00020 These functions are used in GoUct, but should not depend on other classes 00021 in GoUct to avoid cyclic dependencies. 00022 */ 00023 namespace HexUctUtil 00024 { 00025 /** Print information about search as Gfx commands for GoGui. 00026 Can be used for GoGui live graphics during the search or GoGui 00027 analyze command type "gfx" after the search (see http://gogui.sf.net). 00028 The following information is output: 00029 - Move values as influence 00030 - Move counts as labels 00031 - Move with best value marked with circle 00032 - Best response marked with triangle 00033 - Move with highest count marked with square (if different from move 00034 with best value) 00035 - Status line text: 00036 - N = Number games 00037 - V = Value of root node 00038 - Len = Average simulation sequence length 00039 - Tree = Average/maximum moves of simulation sequence in tree 00040 - Abrt = Percentage of games aborted (due to maximum game length) 00041 - Gm/s = Simulations per second 00042 @param search The search containing the tree and statistics 00043 @param toPlay The color toPlay at the root node of the tree 00044 @param out The stream to write the gfx commands to 00045 */ 00046 void GoGuiGfx(const SgUctSearch& search, SgBlackWhite toPlay, 00047 std::ostream& out); 00048 00049 /** RAVE is more efficient if we know the max number of moves we 00050 can have. Simply returns FIRST_INVALID. */ 00051 int ComputeMaxNumMoves(); 00052 00053 /** Method used to print SgMoves during UCT. */ 00054 std::string MoveString(SgMove move); 00055 00056 /** Converts a HexColor to SgBlackWhite (Note: cannot be EMPTY). */ 00057 SgBlackWhite ToSgBlackWhite(HexColor c); 00058 00059 /** Saves the uct tree to an sgf. */ 00060 void SaveTree(const SgUctTree& tree, const StoneBoard& brd, 00061 HexColor toPlay, std::ostream& out, int maxDepth); 00062 } 00063 00064 //---------------------------------------------------------------------------- 00065 00066 _END_BENZENE_NAMESPACE_ 00067 00068 #endif // HEXUCTUTIL_H 00069