void GoUctUtil::GfxStatus(const SgUctSearch& search, ostream& out) { const SgUctTree& tree = search.Tree(); const SgUctNode& root = tree.Root(); const SgUctSearchStat& stat = search.Statistics(); SgUctValue abortPercent = stat.m_aborted.Mean() * SgUctValue(100); out << (format( "TEXT N=%.0f V=%.2f Len=%.0f Tree=%.1f/%.1f Abrt=%.0f%% Gm/s=%.0f\n") % root.MoveCount() % root.Mean() % stat.m_gameLength.Mean() % stat.m_movesInTree.Mean() % stat.m_movesInTree.Max() % abortPercent % stat.m_gamesPerSecond); }
void GoUctUtil::GfxStatus(const SgUctSearch& search, ostream& out) { const SgUctTree& tree = search.Tree(); const SgUctNode& root = tree.Root(); const SgUctSearchStat& stat = search.Statistics(); int abortPercent = static_cast<int>(stat.m_aborted.Mean() * 100); out << "TEXT N=" << root.MoveCount() << " V=" << setprecision(2) << root.Mean() << " Len=" << static_cast<int>(stat.m_gameLength.Mean()) << " Tree=" << setprecision(1) << stat.m_movesInTree.Mean() << "/" << static_cast<int>(stat.m_movesInTree.Max()) << " Abrt=" << abortPercent << '%' << " Gm/s=" << static_cast<int>(stat.m_gamesPerSecond) << '\n'; }
void GoUctUtil::GfxBestMove(const SgUctSearch& search, SgBlackWhite toPlay, ostream& out) { const SgUctTree& tree = search.Tree(); const SgUctNode& root = tree.Root(); out << "VAR"; const SgUctNode* bestValueChild = search.FindBestChild(root); if (bestValueChild != 0) { SgPoint move = bestValueChild->Move(); out << ' ' << (toPlay == SG_BLACK ? 'B' : 'W') << ' ' << SgWritePoint(move); } out << '\n'; }
string GoUctUtil::ChildrenStatistics(const SgUctSearch& search, bool bSort, const SgUctNode& node) { ostringstream out; vector<const SgUctNode*> vec; const SgUctTree& tree = search.Tree(); for (SgUctChildIterator it(tree, node); it; ++it) { const SgUctNode& child = *it; vec.push_back(&child); } if (bSort) sort(vec.begin(), vec.end(), IsMeanLess); for (vector<const SgUctNode*>::iterator it = vec.begin(); it != vec.end(); ++it) { const SgUctNode& child = **it; out << search.MoveString(child.Move()) << " -" << " value=" << child.Mean() << " count=" << child.MoveCount() << '\n'; } return out.str(); }
void GoUctUtil::GfxSequence(const SgUctSearch& search, SgBlackWhite toPlay, ostream& out) { vector<SgMove> sequence; search.FindBestSequence(sequence); out << "VAR"; for (size_t i = 0; i < sequence.size(); ++i) { out << (toPlay == SG_BLACK ? " B ": " W ") << SgWritePoint(sequence[i]); toPlay = SgOppBW(toPlay); } out << '\n'; }
void GoUctUtil::GfxMoveValues(const SgUctSearch& search, SgBlackWhite toPlay, ostream& out) { const SgUctTree& tree = search.Tree(); const SgUctNode& root = tree.Root(); out << "INFLUENCE"; if (root.HasChildren()) for (SgUctChildIterator it(tree, root); it; ++it) { const SgUctNode& child = *it; if (! child.HasMean()) continue; float value = SgUctSearch::InverseEval(child.Mean()); // Scale to [-1,+1], black positive double influence = value * 2 - 1; if (toPlay == SG_WHITE) influence *= -1; SgPoint move = child.Move(); out << ' ' << SgWritePoint(move) << ' ' << fixed << setprecision(2) << influence; } out << '\n'; }