本文整理汇总了C++中Bird::getSeqLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Bird::getSeqLength方法的具体用法?C++ Bird::getSeqLength怎么用?C++ Bird::getSeqLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bird
的用法示例。
在下文中一共展示了Bird::getSeqLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shoot
Action Player::shoot(const GameState &pState, const Deadline &pDue) {
if (lastRound != pState.getRound()) {
hmm.clear();
for (unsigned int i = 0; i < pState.getNumBirds(); ++i) {
HMM hmm1(this -> STATES, this -> DIRECTIONS);
hmm.push_back(hmm1);
}
}
for (unsigned int i = 0; i < pState.getNumBirds(); ++i) {
Bird b = pState.getBird(i);
if (b.isDead())
continue;
int n = b.getSeqLength();
// if (n < THRESHOLD || pState.getRound() == 0)
// continue;
std::vector<int> seq(n, 0);
for (int j = 0; j < n; ++j) {
seq[j] = b.getObservation(j);
}
hmm[i].estimateMatrices(seq);
std::vector<long double> em = hmm[i].getNextEmissionDist();
long double max = -1;
int nextMove = -1;
for (int j = 0; j < DIRECTIONS; ++j) {
if (em[j] > max) {
max = em[j];
nextMove = j;
}
}
if (max > MIN_PROBABILITY) {
std::cerr << "Shooting with prob: " << max << std::endl;
hmm[i].printTransitionMatrix();
hmm[i].printEmissionMatrix();
std::cerr << std::endl << std::endl;
++shots;
return Action(i, (EMovement)nextMove);
}
}
// cerr << "Shots: " << shots << endl;
// cerr << "Hits: " << hits << endl;
// if (shots != 0)
// cerr << "Rate: " << (double) hits / (double) shots << endl << endl;
// This line choose not to shoot
return cDontShoot;
}