当前位置: 首页>>代码示例>>C++>>正文


C++ MoveArray::getTupleMove方法代码示例

本文整理汇总了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;
}
开发者ID:welwa,项目名称:ualbertabot,代码行数:32,代码来源:AlphaBeta.cpp

示例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);
	}
}
开发者ID:welwa,项目名称:ualbertabot,代码行数:9,代码来源:AlphaBeta.cpp

示例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);
	}
}
开发者ID:CMPUT350UAlbertabotStrategy,项目名称:Replay-Parser,代码行数:11,代码来源:LargeGame.cpp

示例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";
	}
	
}
开发者ID:levjj,项目名称:ualbertabot,代码行数:19,代码来源:GameState.cpp


注:本文中的MoveArray::getTupleMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。