示例#1
0
void testArmySearch()
{
	//srand(time(NULL));
	
	SearchParameters params;
//	params.initialState = openingBookStateGateway();
	params.initialState = StarcraftState(true);
	params.initialUpperBound = 6000;
	params.goal = defaultProtossGoal();
	params.useAlwaysMakeWorkers = true;
	params.useIncreasingRepetitions = true;
	params.setRepetitionThreshold(DATA.getSupplyProvider(), 1);
	params.setRepetitionThreshold(DATA.getWorker(), 8);
	
	params.setRepetitions( DATA.getAction(BWAPI::UnitTypes::Protoss_Probe), 2);
	params.setRepetitions( DATA.getAction(BWAPI::UnitTypes::Protoss_Pylon), 2);
	params.setRepetitions( DATA.getAction(BWAPI::UnitTypes::Protoss_Gateway), 1);
	params.setRepetitions( DATA.getAction(BWAPI::UnitTypes::Protoss_Zealot), 2);
	params.setRepetitions( DATA.getAction(BWAPI::UnitTypes::Protoss_Dragoon), 2);
	
	params.goal.setGoalMax( DATA.getAction(BWAPI::UnitTypes::Protoss_Probe), 16 );
	params.goal.setGoalMax( DATA.getAction(BWAPI::UnitTypes::Protoss_Gateway), 4 );
	params.goal.setGoalMax( DATA.getAction(BWAPI::UnitTypes::Protoss_Pylon), 4);

	ArmySearch search(params);
	
	SearchResults result = search.search();

    printf("Search took %lf ms\n", result.timeElapsed);
}
示例#2
0
	void setRepetitions()
	{
		// build supply providers in 2's after the first
		params.setRepetitions(DATA.getSupplyProvider(), 2);
		params.setRepetitionThreshold(DATA.getSupplyProvider(), 1);
		
		// build workers in 2s
		params.setRepetitions(DATA.getWorker(), 2);

		// for each action
		for (Action a = 0; a < DATA.size(); ++a)
		{
			// if it's a non depot producing building build in 2s after the first
			if (DATA[a].canProduce() && !DATA[a].isResourceDepot())
			{
				params.setRepetitions(a, 2);
				params.setRepetitionThreshold(a, 1);
			}
		}

	}