7 #include <boost/format.hpp>
12 #define BOOST_FORMAT_BUG
18 os <<
"digraph OSL_DotWriter {\n";
24 os <<
"}\n" << std::flush;
30 os <<
"// " << line <<
"\n";
37 const bool black_turn = turn ==
BLACK;
38 if (written->find(record) != written->end())
40 written->insert(record);
42 std::stringstream range;
49 std::swap(lower_limit, upper_limit);
50 std::swap(lower_bound, upper_bound);
56 #ifndef BOOST_FORMAT_BUG
57 range << (boost::format(
"%d(%d)") % lower_bound % lower_limit);
59 range << lower_bound <<
"(" << lower_limit <<
")";
66 #ifndef BOOST_FORMAT_BUG
67 range << (boost::format(
"%d(%d)") % upper_bound % upper_limit);
69 range << upper_bound <<
"(" << upper_limit <<
")";
72 const char *color = 0;
82 color = (bound == 2) ?
"red" :
"black";
84 std::stringstream bestMove;
86 #ifndef BOOST_FORMAT_BUG
87 os << (boost::format(
"N%x [label=\"l=%d\\n%s\\n%s\",color=%s,shape=box]\n")
88 % record % limit % range.str() % bestMove.str()
91 os <<
"N" << record <<
" [label=\"l=" << limit <<
"\\n" << range.str()
92 <<
"\\n" << bestMove.str()
93 <<
"\",color=" << color <<
",shape=box]\n";
102 bool black_turn = (turn ==
BLACK);
103 if (written->find(record) != written->end())
105 written->insert(record);
108 std::stringstream range;
115 std::swap(lower_limit, upper_limit);
116 std::swap(lower_bound, upper_bound);
119 if (lower_limit >= 0)
122 #ifndef BOOST_FORMAT_BUG
123 range << (boost::format(
"%d(%d)") % lower_bound % lower_limit);
125 range << lower_bound <<
"(" << lower_limit <<
")";
129 if (upper_limit >= 0)
132 #ifndef BOOST_FORMAT_BUG
133 range << (boost::format(
"%d(%d)") % upper_bound % upper_limit);
135 range << upper_bound <<
"(" << upper_limit <<
")";
138 const char *color = 0;
148 color = (bound == 2) ?
"burlywood" :
"cyan";
150 #ifndef BOOST_FORMAT_BUG
151 os << (boost::format(
"N%x [label=\"l=%d\\n%s\",color=%s,shape=box]\n")
152 % record % limit % range.str()
155 os <<
"N" << record <<
" [label=\"l=" << limit <<
"\\n" << range.str()
156 <<
"\",color=" << color <<
",shape=box]\n";
164 if ((written->find(from) != written->end())
165 && (written->find(to) != written->end()))
169 std::stringstream move_string;
171 const char *color = 0;
175 color = (move.
logProb() <= 100) ?
"red" :
"black";
176 #ifndef BOOST_FORMAT_BUG
177 os << (boost::format(
"N%x -> N%x [label=\"%s (%d)\", color=%s, style=bold]\n")
178 % from % to % move_string.str() % move.
logProb() % color);
180 os <<
"N" << from <<
" -> N" << to <<
" [label=\"" << move_string.str()
181 <<
" (" << move.
logProb() <<
")\", color=" << color
182 <<
", style=bold]\n";