int AveragesTab::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: setSimulator((*reinterpret_cast< const Quackle::Simulator(*)>(_a[1]))); break; case 1: { QString _r = statisticTable((*reinterpret_cast< const Quackle::Simulator(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 2: explain(); break; } _id -= 3; } return _id; }
void AveragesTab::setSimulator(const Quackle::Simulator &simulator) { QString html; html += statisticTable(simulator); html += "<hr />"; const Quackle::SimmedMoveList::const_iterator end(simulator.simmedMoves().end()); for (Quackle::SimmedMoveList::const_iterator it = simulator.simmedMoves().begin(); it != end; ++it) { if (!(*it).includeInSimulation()) continue; QString levels; for (Quackle::LevelList::const_iterator levelIt = (*it).levels.begin(); levelIt != (*it).levels.end(); ++levelIt) { QString plays; for (Quackle::PositionStatisticsList::const_iterator valueIt = (*levelIt).statistics.begin(); valueIt != (*levelIt).statistics.end(); ++valueIt) { //plays += QString("(%1) ").arg((*valueIt).score.averagedValue()); //plays += tr("(bingos %1) ").arg((*valueIt).bingos.averagedValue()); } if (!plays.isEmpty()) levels += QString("<li>%1</li>").arg(plays); } html += QString("<h3>%1</h3><ol>%2</ol>").arg(QuackleIO::Util::moveToDetailedString((*it).move)).arg(levels); html += "<ul>"; if ((*it).residual.hasValues()) html += tr("<li>Rack leftover value: %1</li>").arg((*it).residual.averagedValue()); if ((*it).gameSpread.hasValues()) html += tr("<li>Spread: %1 (sd %2)</li>").arg((*it).gameSpread.averagedValue()).arg((*it).gameSpread.standardDeviation()); html += tr("<li>Valuation: %1</li>").arg((*it).calculateEquity()); html += tr("<li>Bogowin %: %1%</li>").arg((*it).calculateWinPercentage()); html += "</ul>"; } // TODO don't scroll to top when resetting m_textEdit->setHtml(html); }
void AveragesTab::setSimulator(const Quackle::Simulator &simulator) { QString html; html += statisticTable(simulator); html += "<hr />"; for (const auto& it : simulator.simmedMoves()) { if (!it.includeInSimulation()) continue; QString levels; for (const auto& levelIt : it.levels) { QString plays; for (const auto& valueIt : levelIt.statistics) { //plays += QString("(%1) ").arg((*valueIt).score.averagedValue()); //plays += tr("(bingos %1) ").arg((*valueIt).bingos.averagedValue()); } if (!plays.isEmpty()) levels += QString("<li>%1</li>").arg(plays); } html += QString("<h3>%1</h3><ol>%2</ol>").arg(QuackleIO::Util::moveToDetailedString(it.move)).arg(levels); html += "<ul>"; if (it.residual.hasValues()) html += tr("<li>Rack leftover value: %1</li>").arg(it.residual.averagedValue()); if (it.gameSpread.hasValues()) html += tr("<li>Spread: %1 (sd %2)</li>").arg(it.gameSpread.averagedValue()).arg(it.gameSpread.standardDeviation()); html += tr("<li>Valuation: %1</li>").arg(it.calculateEquity()); html += tr("<li>Bogowin %: %1%</li>").arg(it.calculateWinPercentage()); html += "</ul>"; } // TODO don't scroll to top when resetting m_textEdit->setHtml(html); }