• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ bwapi::Position类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中bwapi::Position的典型用法代码示例。如果您正苦于以下问题:C++ Position类的具体用法?C++ Position怎么用?C++ Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Position类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: buildGateway

void buildGateway(){
	resourceSemaphore = true;
	Unidade* worker = Protoss_Workers[numWorkers-1];
	Selected_Worker = worker;
	Unidade* Selected_Pylon = Protoss_Pylons[numPylons-1];
	Unidade* nexus = Protoss_Nexus;
	int delta_y;
	int delta_x;
	int desviox=0;
	int desvioy=0;
	delta_y	=	nexus->getPosition().y() - Selected_Pylon->getPosition().y();
	delta_x =	nexus->getPosition().x() - Selected_Pylon->getPosition().x();
	BWAPI::Position setPos = BWAPI::Position(Selected_Pylon->getPosition().x()-delta_x*3/2,Selected_Pylon->getPosition().y()-delta_y*3/2);
	worker->build(BWAPI::TilePosition(setPos),UnitTypes::Protoss_Gateway);
	while(!worker->isConstructing())
	{
		desviox += 5*(rand()%3-1);
		desvioy += 5*(rand()%3-1);
		setPos = BWAPI::Position(Selected_Pylon->getPosition().x()-delta_x*3/2+desviox,Selected_Pylon->getPosition().y()-delta_y*3/2+desvioy);
		worker->build(BWAPI::TilePosition(setPos),UnitTypes::Protoss_Gateway);
	}
	printf("X:%d Y:%d \n",setPos.x(),setPos.y());
	Selected_Worker = NULL;
	resourceSemaphore = false;
}
开发者ID:pedroneves,项目名称:bloodbath-and-beyond,代码行数:25,代码来源:MeuAgentePrincipal.cpp


示例2: getMoveTo

	// given a position, get the position we should move to to minimize distance
	BWAPI::Position getMoveTo(const BWAPI::Position p, const int lookAhead = 1) const
	{
		// the initial row an column
		int row = p.y() / 32;
		int col = p.x() / 32;
		
		// for each lookahead
		for (int i=0; i<lookAhead; ++i)
		{
			// get the index
			int index = getIndex(row,col);

			// adjust the row and column accordingly
			if (moveTo[index] == 'L')
			{
				col -= 1;
			} 
			else if (moveTo[index] == 'R')
			{
				col += 1;
			} 
			else if (moveTo[index] == 'U')
			{
				row -= 1;
			} 
			else
			{
				row += 1;
			}
		}

		// return the position
		return BWAPI::Position(col * 32 + 16, row * 32 + 16);
	}
开发者ID:adamjford,项目名称:ualbertabot,代码行数:35,代码来源:DistanceMap.hpp


示例3: onNukeDetect

void StarCraftAIModule::onNukeDetect(BWAPI::Position target)
{
	if (target!=Positions::Unknown)
		Broodwar->printf("Nuclear Launch Detected at (%d,%d)",target.x(),target.y());
	else
		Broodwar->printf("Nuclear Launch Detected");
}
开发者ID:anas-salama,项目名称:IStrategizer,代码行数:7,代码来源:StarCraftAIModule.cpp


示例4: onNukeDetect

void BattleBroodAI::onNukeDetect(BWAPI::Position target)
{
	micro->onNukeDetect(target);
    if (target!=Positions::Unknown)
    	Broodwar->printf("Nuclear Launch Detected at (%d,%d)",target.x(),target.y());
    else
    	Broodwar->printf("Nuclear Launch Detected");
}
开发者ID:AIUR-group,项目名称:BroodwarBotQ,代码行数:8,代码来源:MacroProject.cpp


示例5: operator

	bool operator()(const BWAPI::Position lhs, const BWAPI::Position rhs)
	{
		if (lhs.getDistance(InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy())->getPosition()) <
			rhs.getDistance(InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy())->getPosition())) return true;
		//ensure each position gets added to the set
		if (lhs.getDistance(InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy())->getPosition()) >
			rhs.getDistance(InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy())->getPosition())) return false;
		return true;
	}
开发者ID:Ajamal,项目名称:BornToWinBot,代码行数:9,代码来源:BaitManager.cpp


示例6: move

void UnitMng::move()
{
	BWAPI::Position* currentPosition= new BWAPI::Position((this->conUnit)->getPosition());
	BWAPI::Position *movePosition;
	int updown=128*(outputs[3]-0.5);
	int leftright=128*(outputs[4]-0.5);
	movePosition= new BWAPI::Position((currentPosition->x() + updown),(currentPosition->y()+leftright));
	movePosition->makeValid();
	this->conUnit->move(*movePosition);
}
开发者ID:b4rdos,项目名称:StarBard,代码行数:10,代码来源:UnitMng.cpp


示例7: calculate_walk_distances_area

 void calculate_walk_distances_area(const BWAPI::Position& start
                                    , int width
                                    , int height
                                    , int max_distance
                                    , RectangleArray<int>& distance_map)
 {
     Heap<BWAPI::Position, int> heap(true);
     for (unsigned int x = 0;x < distance_map.getWidth();x++) {
         for (unsigned int y = 0;y < distance_map.getHeight();y++) {
             distance_map[x][y] = -1;
         }
     }
     int sx = (int)start.x();
     int sy = (int)start.y();
     for (int x = sx;x < sx + width;x++) {
         for (int y = sy;y < sy + height;y++) {
             heap.push(std::make_pair(BWAPI::Position(x, y), 0));
             distance_map[x][y] = 0;
         }
     }
     while (!heap.empty()) {
         BWAPI::Position pos = heap.top().first;
         int distance = heap.top().second;
         heap.pop();
         int x = (int)pos.x();
         int y = (int)pos.y();
         if (distance > max_distance && max_distance > 0)
             break;
         int min_x = max(x - 1, 0);
         int max_x = min(x + 1, BWAPI::Broodwar->mapWidth() * 4 - 1);
         int min_y = max(y - 1, 0);
         int max_y = min(y + 1, BWAPI::Broodwar->mapHeight() * 4 - 1);
         for (int ix = min_x;ix <= max_x;ix++) {
             for (int iy = min_y;iy <= max_y;iy++) {
                 int f = abs(ix - x) * 10 + abs(iy - y) * 10;
                 if (f > 10) {
                     f = 14;
                 }
                 int v = distance + f;
                 if (distance_map[ix][iy] > v) {
                     heap.set(BWAPI::Position(x, y), v);
                     distance_map[ix][iy] = v;
                 } else {
                     if (distance_map[ix][iy] == -1 && MapData::rawWalkability[ix][iy] == true) {
                         distance_map[ix][iy] = v;
                         heap.push(std::make_pair(BWAPI::Position(ix, iy), v));
                     }
                 }
             }
         }
     }
 }
开发者ID:krasi0,项目名称:bwapi-bwta-map-analyzer,代码行数:52,代码来源:util.cpp


示例8: calculate_walk_distances

 void calculate_walk_distances(const RectangleArray<bool>& read_map
                               , const BWAPI::Position& start
                               , int max_distance
                               , RectangleArray<int>& distance_map)
 {
     Heap<BWAPI::Position, int> heap(true);
     for (unsigned int x = 0;x < distance_map.getWidth();x++) {
         for (unsigned int y = 0;y < distance_map.getHeight();y++) {
             distance_map[x][y] = -1;
         }
     }
     heap.push(std::make_pair(start, 0));
     int sx = (int)start.x();
     int sy = (int)start.y();
     distance_map[sx][sy] = 0;
     while (!heap.empty()) {
         BWAPI::Position pos = heap.top().first;
         int distance = heap.top().second;
         heap.pop();
         int x = (int)pos.x();
         int y = (int)pos.y();
         if (distance > max_distance && max_distance > 0)
             break;
         int min_x = max(x - 1, 0);
         int max_x = min(x + 1, read_map.getWidth() - 1);
         int min_y = max(y - 1, 0);
         int max_y = min(y + 1, read_map.getHeight() - 1);
         for (int ix = min_x;ix <= max_x;ix++) {
             for (int iy = min_y;iy <= max_y;iy++) {
                 int f = abs(ix - x) * 10 + abs(iy - y) * 10;
                 if (f > 10) {
                     f = 14;
                 }
                 int v = distance + f;
                 if (distance_map[ix][iy] > v) {
                     heap.set(BWAPI::Position(x, y), v);
                     distance_map[ix][iy] = v;
                 } else {
                     if (distance_map[ix][iy] == -1 && read_map[ix][iy] == true) {
                         distance_map[ix][iy] = v;
                         heap.push(std::make_pair(BWAPI::Position(ix, iy), v));
                     }
                 }
             }
         }
     }
 }
开发者ID:krasi0,项目名称:bwapi-bwta-map-analyzer,代码行数:47,代码来源:util.cpp


示例9: printGraphicDebugInfo

void PlayerSquad::printGraphicDebugInfo() const {
	// Skip if not turned on
	if (config::debug::GRAPHICS_VERBOSITY == config::debug::GraphicsVerbosity_Off || !isDebugOn())
	{
		return;
	}

	// Low
	// Print id, state, number of units and number of supplies.
	if (config::debug::GRAPHICS_VERBOSITY >= config::debug::GraphicsVerbosity_Low) {
		if (!mCenter.empty()) {
			BWAPI::Position squadCenterOnMap = BWAPI::Position(mCenter.front());

			BWAPI::Broodwar->drawTextMap(squadCenterOnMap.x(), squadCenterOnMap.y(), "%s", getDebugString().c_str());
		}
	}


	// Medium
	// Draw line from the front and back center, display the length of this line
	if (config::debug::GRAPHICS_VERBOSITY >= config::debug::GraphicsVerbosity_Medium) {
		if (!mCenter.empty()) {
			pair<Position, Position> squadMovement = make_pair(mCenter.front(), mCenter.back());

			// Length
			double length = (mCenter.front() - mCenter.back()).getLength();

			// Draw line
			Broodwar->drawLineMap(
				squadMovement.first.x(), squadMovement.first.y(),
				squadMovement.second.x(), squadMovement.second.y(),
				Colors::Purple
				);

			int xOffset = -64;

			// Draw text in back of line
			Broodwar->drawTextMap(
				squadMovement.second.x() + xOffset, squadMovement.second.y(),
				"%sLength: %g",
				TextColors::PURPLE.c_str(),
				length
				);

		}
	}
}
开发者ID:Senth,项目名称:bats,代码行数:47,代码来源:PlayerSquad.cpp


示例10: moveFormation

void Fireteam::moveFormation(BWAPI::Position pos) {
	mission.objectivePosition = pos;
	for(std::set<BWAPI::Unit*>::const_iterator i=units.begin(); i != units.end(); i++)
	{	
		
		(*i)->move(BWAPI::Position::Position(pos.x() + (int)formation.positionMap[(*i)].xOffset, pos.y() + (int)formation.positionMap[(*i)].yOffset), 0);
	}
}
开发者ID:JonahBrooks,项目名称:ESCAIP,代码行数:8,代码来源:Fireteam.cpp


示例11: camera

	void AIModule::camera()
	{
		if (game->getMouseState(BWAPI::M_LEFT))
		{
			return;
		}

		const int CENTER_SCREEN_X = 320;
		const int CENTER_SCREEN_Y = 140;

		if (!autocam)
		{
			return;
		}

		UnitGroup interestingUnits = AllUnits()(isAttacking);

		if (interestingUnits.size() == 0)
		{
			return;
		}

		BWAPI::Unit *unit = (*interestingUnits.begin());

		BWAPI::Position unitPosition = unit->getPosition();

		int x, y;
		x = unitPosition.x() - CENTER_SCREEN_X;
		y = unitPosition.y() - CENTER_SCREEN_Y;

		if (x < 0)
		{
			x = 0;
		}

		if (y < 0)
		{
			y = 0;
		}

		BWAPI::Broodwar->setScreenPosition(x, y);
	}
开发者ID:albertouri,项目名称:dementor-bot,代码行数:42,代码来源:AIModule.cpp


示例12: getSectorCornerPosition

BWAPI::Position getSectorCornerPosition (char s, int c){
	int width = centro.x()*2;
	int height = centro.y()*2;

	double C1 = width / 3;
	double C2 = (2*width) / 3;

	double L1 = height / 3;
	double L2 = (2*height) / 3;

	double halfSectorWidth = (C1 / 2);
	double halfSectorHeight = (L1 / 2);

	BWAPI::Position sectorCenter = getSectorCenter(s);

	if(c == 0) return BWAPI::Position((int) (sectorCenter.x() - halfSectorWidth), (int) (sectorCenter.y() - halfSectorHeight));
	if(c == 1) return BWAPI::Position((int) (sectorCenter.x() + halfSectorWidth), (int) (sectorCenter.y() - halfSectorHeight));
	if(c == 2) return BWAPI::Position((int) (sectorCenter.x() - halfSectorWidth), (int) (sectorCenter.y() + halfSectorHeight));
	if(c == 3) return BWAPI::Position((int) (sectorCenter.x() + halfSectorWidth), (int) (sectorCenter.y() + halfSectorHeight));
}
开发者ID:pedroneves,项目名称:bloodbath-and-beyond,代码行数:20,代码来源:MeuAgentePrincipal.cpp


示例13: RushDefend

void ProductionManager::RushDefend(BWAPI::UnitType defendBuilding, int buildingCount, BWAPI::UnitType defendUnit, int unitCount)
{
	BWAPI::Position chokePosition = BWTA::getNearestChokepoint(BWAPI::Broodwar->self()->getStartLocation())->getCenter();
	BWAPI::Position basePositon = BWAPI::Position(BWAPI::Broodwar->self()->getStartLocation());

	double2 direc = chokePosition - basePositon;
	double2 direcNormal = direc / direc.len();
	int targetx = (basePositon.x() + int(direcNormal.x * 32 * 10)) / 32;
	int targety = (basePositon.y() + int(direcNormal.y * 32 * 10)) / 32;

	for (int i = 0; i < unitCount; i++)
	{
		queue.queueAsHighestPriority(defendUnit, false);
	}

	for (int i = 0; i < buildingCount; i++)
	{
		queue.queueAsHighestPriority(MetaType(BWAPI::UnitTypes::Zerg_Creep_Colony, BWAPI::TilePosition(targetx, targety)), true);
		queue.queueAsHighestPriority(defendBuilding, false);
	}
}
开发者ID:bitisony,项目名称:Overkill,代码行数:21,代码来源:ProductionManager.cpp


示例14: onSendText

	void AIModule::onSendText(std::string text)
	{
		game->printf(text.c_str());

		if (text == "dbg")
		{
			debug = !debug;

			buildOrderManager->setDebugMode(debug);

			game->printf("Debug turned %s.", (debug) ? "on" : "off");
		}

		if (text == "atc")
		{
			autocam = !autocam;

			game->printf("Autocam turned %s.", (autocam) ? "on" : "off");
		}

		if (text == "gsn")
		{
			localSpeed = 30;
			frameSkip = 0;

			updateGameSpeed();
		}

		if (text == "gsf")
		{
			localSpeed = 0;
			frameSkip = 0;

			updateGameSpeed();
		}

		if (text == "gsfs")
		{
			localSpeed = 0;
			frameSkip = 8;

			updateGameSpeed();
		}

		if (text == "atk")
		{
			BWAPI::Position mousePosition = game->getMousePosition();
			BWAPI::Position screenPosition = game->getScreenPosition();

			BWAPI::Position mapPosition = BWAPI::Position(mousePosition.x() + screenPosition.x(), mousePosition.y() + screenPosition.y());
			agentManager->attackMoveTo(mapPosition);

			game->printf("Issued manual attack at %d %d.", mapPosition.x(), mapPosition.y());
		}
	}
开发者ID:albertouri,项目名称:dementor-bot,代码行数:55,代码来源:AIModule.cpp


示例15: onNukeDetect

void ExampleAIModule::onNukeDetect(BWAPI::Position target)
{

  // Check if the target is a valid position
  if ( target )
  {

    // if so, print the location of the nuclear strike target
    Broodwar->printf("Nuclear Launch Detected at (%d,%d)", target.x(), target.y() );

  }
  else 
  {

    // Otherwise, ask other players where the nuke is!
    Broodwar->sendText("Where's the nuke?");

  }

  // You can also retrieve all the nuclear missile targets using Broodwar->getNukeDots()!

}
开发者ID:RadicalZephyr,项目名称:bwapi,代码行数:22,代码来源:ExampleAIModule.cpp


示例16: getSectorCenter

BWAPI::Position getSectorCenter (char s){

	/*
		Dividindo o mapa em 9 setores:

			   (C1)   (C2)
			  A  |  B  |  C  
			----------------- (L1)
			  K  |  L  |  M  
			----------------- (L2)
			  X  |  Y  |  Z  

		A funcao recebe um setor e retorna o ponto central do setor
	*/

	int width = centro.x()*2;
	int height = centro.y()*2;

	double C1 = width / 3;
	double C2 = (2*width) / 3;

	double L1 = height / 3;
	double L2 = (2*height) / 3;

	double halfSectorWidth = (C1 / 2);
	double halfSectorHeight = (L1 / 2);

	if(s == 'A') return BWAPI::Position((int) halfSectorWidth, (int) halfSectorHeight);
	if(s == 'B') return BWAPI::Position((int) (C1 + halfSectorWidth), (int) halfSectorHeight);
	if(s == 'C') return BWAPI::Position((int) (C2 + halfSectorWidth), (int) halfSectorHeight);
	if(s == 'K') return BWAPI::Position((int) halfSectorWidth, (int) (L1 + halfSectorHeight));
	if(s == 'L') return BWAPI::Position((int) (C1 + halfSectorWidth), (int) (L1 + halfSectorHeight));
	if(s == 'M') return BWAPI::Position((int) (C2 + halfSectorWidth), (int) (L1 + halfSectorHeight));
	if(s == 'X') return BWAPI::Position((int) halfSectorWidth, (int) (L2 + halfSectorHeight));
	if(s == 'Y') return BWAPI::Position((int) (C1 + halfSectorWidth), (int) (L2 + halfSectorHeight));
	if(s == 'Z') return BWAPI::Position((int) (C2 + halfSectorWidth), (int) (L2 + halfSectorHeight));
}
开发者ID:pedroneves,项目名称:bloodbath-and-beyond,代码行数:37,代码来源:MeuAgentePrincipal.cpp


示例17: setCombatUnits

// sets the starting states based on the combat units within a radius of a given position
// this center will most likely be the position of the forwardmost combat unit we control
void CombatSimulation::setCombatUnits(const BWAPI::Position & center, const int radius)
{
	MicroSearch::GameState s;
	s.setMaxUnits(100);

	BWAPI::Broodwar->drawCircleMap(center.x(), center.y(), 10, BWAPI::Colors::Red, true);

	std::vector<BWAPI::Unit *> ourCombatUnits;
	std::vector<UnitInfo> enemyCombatUnits;
	MapGrid::Instance().GetUnits(ourCombatUnits,   center, Options::Micro::COMBAT_REGROUP_RADIUS, true, false);
	InformationManager::Instance().getNearbyForce(enemyCombatUnits, center, BWAPI::Broodwar->enemy(), Options::Micro::COMBAT_REGROUP_RADIUS);


	int y = 0;

	BOOST_FOREACH (BWAPI::Unit * unit, ourCombatUnits)
	{
		if (InformationManager::Instance().isCombatUnit(unit->getType()))
		{
			s.addUnit(MicroSearch::Unit(unit, getPlayer(BWAPI::Broodwar->self()), BWAPI::Broodwar->getFrameCount()));
		}
	}

	y++;

	BOOST_FOREACH (UnitInfo ui, enemyCombatUnits)
	{
		if (!ui.type.isFlyer())
		{
			s.addUnit(getUnit(ui, getPlayer(BWAPI::Broodwar->enemy())));
		}
	}

	s.finishedMoving();

	state = s;
}
开发者ID:yulonglong,项目名称:KesterBot,代码行数:39,代码来源:CombatSimulation.cpp


示例18: SmartMove

void Micro::SmartMove(BWAPI::UnitInterface* attacker, const BWAPI::Position & targetPosition)
{
    UAB_ASSERT(attacker, "SmartAttackMove: Attacker not valid");
    UAB_ASSERT(targetPosition.isValid(), "SmartAttackMove: targetPosition not valid");

    if (!attacker || !targetPosition.isValid())
    {
        return;
    }

    // if we have issued a command to this unit already this frame, ignore this one
    if (attacker->getLastCommandFrame() >= BWAPI::Broodwar->getFrameCount() || attacker->isAttackFrame())
    {
        return;
    }

    // get the unit's current command
    BWAPI::UnitCommand currentCommand(attacker->getLastCommand());

    // if we've already told this unit to move to this position, ignore this command
    if ((currentCommand.getType() == BWAPI::UnitCommandTypes::Move) && (currentCommand.getTargetPosition() == targetPosition) && attacker->isMoving())
    {
        return;
    }

    // if nothing prevents it, attack the target
    attacker->move(targetPosition);
    TotalCommands++;

    if (Config::Debug::DrawUnitTargetInfo) 
    {
        BWAPI::Broodwar->drawCircleMap(attacker->getPosition(), dotRadius, BWAPI::Colors::White, true);
        BWAPI::Broodwar->drawCircleMap(targetPosition, dotRadius, BWAPI::Colors::White, true);
        BWAPI::Broodwar->drawLineMap(attacker->getPosition(), targetPosition, BWAPI::Colors::White);
    }
}
开发者ID:ssssuishui,项目名称:ualbertabot,代码行数:36,代码来源:Micro.cpp


示例19: nextSpiralPosition

BWAPI::Position nextSpiralPosition (Unidade* u, BWAPI::Position center){
	/*
		Faz o batedor andar em expiral, em torno da primeira unidade encontrada.

		Para cada volta, divide a circunferencia em quatro setores que serao para onde
		o batedor ira se mover. Se no final de uma volta, nao encontrar o centro de comando
		inicia mais uma volta porem dessa vez, com o raio maior em spiralRadiusDelta
	*/

	int spiralRadius = (spiralTurn*spiralRadiusDelta);

	if(distance(u->getPosition(), nextSpiralSectorPosition) > spiralGoalRadius){
		if(distance(u->getPosition(), nextSpiralSectorPosition) >= lastDistanceToNextSpiralSector){
			nextSpiralSectorReachTryAmount = nextSpiralSectorReachTryAmount + 1;
		}

		if(nextSpiralSectorReachTryAmount >= maxAmountTryReachSpiralGoalRadius){
			spiralSector = spiralSector + 1;
			nextSpiralSectorReachTryAmount = 0;
		}
	}else{
		nextSpiralSectorReachTryAmount = 0;
		spiralSector = spiralSector + 1;
	}

	if(spiralSector == 0){
		nextSpiralSectorPosition = BWAPI::Position(center.x(), (center.y() - spiralRadius));
	}else if(spiralSector == 1){
		nextSpiralSectorPosition = BWAPI::Position((center.x() + spiralRadius), center.y());
	}else if(spiralSector == 2){
		nextSpiralSectorPosition = BWAPI::Position(center.x(), (center.y() + spiralRadius));
	}else if(spiralSector == 3){
		nextSpiralSectorPosition = BWAPI::Position((center.x() - spiralRadius), center.y());

		// fim da volta. Incrementa a volta e reinicia o sector
		spiralTurn = spiralTurn + 1;
		spiralSector = -1;
	}

	return nextSpiralSectorPosition;
}
开发者ID:pedroneves,项目名称:bloodbath-and-beyond,代码行数:41,代码来源:MeuAgentePrincipal.cpp


示例20: getSector

char getSector (BWAPI::Position p){
	/*
		Dividindo o mapa em 9 setores:

			   (C1)   (C2)
			  A  |  B  |  C  
			----------------- (L1)
			  K  |  L  |  M  
			----------------- (L2)
			  X  |  Y  |  Z  

		A funcao recebe uma posicao e retorna em qual setor estah
	*/

	int width = centro.x()*2;
	int height = centro.y()*2;

	double C1 = width / 3;
	double C2 = (2*width) / 3;

	double L1 = height / 3;
	double L2 = (2*height) / 3;

	if(p.x() < C1 && p.y() < L1) return 'A';
	if(p.x() > C1 && p.x() < C2 && p.y() < L1) return 'B';
	if(p.x() > C2 && p.y() < L1) return 'C';

	if(p.x() < C1 && p.y() > L1 && p.y() < L2) return 'K';
	if(p.x() > C1 && p.x() < C2 && p.y() > L1 && p.y() < L2) return 'L';
	if(p.x() > C2 && p.y() > L1 && p.y() < L2) return 'M';

	if(p.x() < C1 && p.y() > L2) return 'X';
	if(p.x() > C1 && p.x() < C2 && p.y() > L2) return 'Y';
	if(p.x() > C2 && p.y() > L2) return 'Z';
}
开发者ID:pedroneves,项目名称:bloodbath-and-beyond,代码行数:35,代码来源:MeuAgentePrincipal.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ bwapi::TilePosition类代码示例发布时间:2022-05-31
下一篇:
C++ bwapi::Player类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap