本文整理汇总了C++中MoveArray::getTupleMove方法的典型用法代码示例。如果您正苦于以下问题:C++ MoveArray::getTupleMove方法的具体用法?C++ MoveArray::getTupleMove怎么用?C++ MoveArray::getTupleMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoveArray
的用法示例。
在下文中一共展示了MoveArray::getTupleMove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pruneMove
const bool AlphaBeta::pruneMove(GameState & state, const IDType & playerToMove, const MoveArray & moves, const MoveTuple & tuple) const
{
IDType enemy(getEnemy(playerToMove));
// damage assigned to each enemy unit so far
int hpRemaining[Search::Constants::Max_Units];
for (IDType u(0); u<state.numUnits(enemy); ++u)
{
hpRemaining[u] = state.getUnit(enemy,u).currentHP();
}
// for each unit in the tuple
for (size_t u(0); u<moves.numUnits(); u++)
{
// get its move
const Move & m(moves.getTupleMove(tuple, u));
if (m.type() == MoveTypes::ATTACK)
{
// if the target unit has already been killed then return prune
if (hpRemaining[m.index()] <= 0)
{
return true;
}
hpRemaining[m.index()] -= state.getUnit(playerToMove, u).damage();
}
}
return false;
}
示例2: doTupleMoves
void AlphaBeta::doTupleMoves(GameState & state, MoveArray & moves, const MoveTuple & tuple)
{
// for each simultaneous move in this tuple
for (size_t u(0); u<moves.numUnitsInTuple(); ++u)
{
Move m = moves.getTupleMove(tuple, u);
state.makeMove(m, state);
}
}
示例3: makeMoves
// causes playerToMove() to make the moves in the tuple
void LargeGame::makeMoves(const MoveTuple & tuple, MoveArray & arr)
{
// for each simultaneous move in this tuple
for (size_t u(0); u<arr.numUnitsInTuple(); ++u)
{
Move m = arr.getTupleMove(tuple, u);
//printf(" Move (%d, %d) (%s, %s)\n", (int)tuple, (int)u, state.getUnit(m.player(), m.unit()).name().c_str(), m.moveString().c_str());
state.makeMove(m, state);
}
}
示例4: printMoveTuple
void GameState::printMoveTuple(const IDType & player, const MoveTuple & t) const
{
printf("\n");
MoveArray moves;
generateMoves(moves, player);
for (size_t u(0); u<moves.numUnitsInTuple(); ++u)
{
Move m = moves.getTupleMove(t, u);
std::cout << "Player " << (int)m.player() << " " << getUnit(m.player(), m.unit()).name() << " (id=" << (int)m.unit() << ")" << " " << m.moveString() ;
if (m.type() == MoveTypes::ATTACK)
{
std::cout << " target " << getUnit(getEnemy(m.player()), m.index()).name() << " (id=" << (int)m.index() << ")";
}
std::cout << "\n";
}
}