+ if (square_rank(move_from(candidates[i])) == square_rank(from))
+ r++;
+ }
+
+ return f == 1 ? AMBIGUITY_FILE : r == 1 ? AMBIGUITY_RANK : AMBIGUITY_BOTH;
+ }
+
+
+ const string time_string(int millisecs) {
+
+ const int MSecMinute = 1000 * 60;
+ const int MSecHour = 1000 * 60 * 60;
+
+ std::stringstream s;
+ s << std::setfill('0');
+
+ int hours = millisecs / MSecHour;
+ int minutes = (millisecs - hours * MSecHour) / MSecMinute;
+ int seconds = (millisecs - hours * MSecHour - minutes * MSecMinute) / 1000;
+
+ if (hours)
+ s << hours << ':';
+
+ s << std::setw(2) << minutes << ':' << std::setw(2) << seconds;
+ return s.str();
+ }
+
+
+ const string score_string(Value v) {
+
+ std::stringstream s;
+
+ if (v >= VALUE_MATE - 200)
+ s << "#" << (VALUE_MATE - v + 1) / 2;
+ else if (v <= -VALUE_MATE + 200)
+ s << "-#" << (VALUE_MATE + v) / 2;
+ else
+ {
+ float floatScore = float(v) / float(PawnValueMidgame);
+ if (v >= 0)
+ s << '+';
+
+ s << std::setprecision(2) << std::fixed << floatScore;
+ }
+ return s.str();
+ }