ANALYZE: 解决胜负和以及总盘数统计数据被加倍的问题 (WAR)

This commit is contained in:
Calcitem 2020-11-20 00:41:40 +08:00
parent 0ddc151fd4
commit ff49f82c4c
1 changed files with 8 additions and 8 deletions

View File

@ -247,11 +247,11 @@ void sq2str(char *str)
void Thread::analyze(Color c)
{
static int nbwin = 0;
static int nwwin = 0;
static int ndraw = 0;
static float nbwin = 0;
static float nwwin = 0;
static float ndraw = 0;
#ifndef QT_GUI_LIB
int total;
float total;
float bwinrate, wwinrate, drawrate;
#endif // !QT_GUI_LIB
@ -282,13 +282,13 @@ void Thread::analyze(Color c)
case PHASE_GAMEOVER:
if (p->get_winner() == DRAW) {
cout << "和棋" << endl;
ndraw++;
ndraw += 0.5; // TODO
} else if (p->get_winner() == BLACK) {
cout << "黑方胜" << endl;
nbwin++;
nbwin += 0.5; // TODO
} else if (p->get_winner() == WHITE) {
cout << "白方胜" << endl;
nwwin++;
nwwin += 0.5; // TODO
}
goto out;
break;
@ -377,7 +377,7 @@ void Thread::analyze(Color c)
drawrate = (float)ndraw * 100 / total;
}
cout << "比分: " << nbwin << " : " << nwwin << " : " << ndraw << "\ttotal: " << total << endl;
cout << "比分: " << (int)nbwin << " : " << (int)nwwin << " : " << (int)ndraw << "\ttotal: " << (int)total << endl;
cout << fixed << setprecision(2) << bwinrate << "% : " << wwinrate << "% : " << drawrate << "%" << endl;
#endif // !QT_GUI_LIB