⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pass.cpp

📁 RoboCup 2D 仿真组老牌强队Mersad 2005的完整源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	for (unsigned i = 0; i < num; i++)	{		statusOppNumWeight[i] = reRate(statusOppNumValue,									   factors[i]->statusOppNum.minValue,									   factors[i]->statusOppNum.maxValue,									   factors[i]->statusOppNum.minWeight,									   factors[i]->statusOppNum.maxWeight,									   RRM_REVERSE);		if (logLevel >= 2)			LOG << " " << statusOppNumWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating statusOppDist weight and statusOppDir weight	float statusOppDistValue = interCalc.getNearestOppToFastestDist();	float statusOppDirValue = interCalc.getNearestOppToFastestDir();	statusOppDistValue += 2.1;	if (logLevel >= 2)		LOG << "statusOppDistValue: " << statusOppDistValue << endl			<< "statusOppDirValue: " << statusOppDirValue << endl			<< "statusOpp(Dist,Dir)Weight:";	for (unsigned i = 0; i < num; i++)	{		statusOppDistWeight[i] = reRate(statusOppDistValue,										factors[i]->statusOppDist.minValue,										factors[i]->statusOppDist.maxValue,										factors[i]->statusOppDist.minWeight,										factors[i]->statusOppDist.maxWeight,										RRM_DIRECT);		statusOppDirWeight[i] = reRate(statusOppDirValue,									   factors[i]->statusOppDir.minValue,									   factors[i]->statusOppDir.maxValue,									   factors[i]->statusOppDir.minWeight,									   factors[i]->statusOppDir.maxWeight,									   RRM_DIRECT);		if (logLevel >= 2)			LOG << " " << Point(statusOppDistWeight[i], statusOppDirWeight[i]);	}	if (logLevel >= 2)		LOG << endl;	// calculating breakOffside weight	float breakOffsideValue = checkInterPlayer.getInterPoint().x -		worldModel->getOppOffsideLine();	if (logLevel >= 2)		LOG << "breakOffsideValue: " << breakOffsideValue << endl			<< "breakOffsideWeight:";	for (unsigned i = 0; i < num; i++)	{		breakOffsideWeight[i] = reRate(breakOffsideValue,									   factors[i]->breakOffside.minValue,									   factors[i]->breakOffside.maxValue,									   factors[i]->breakOffside.minWeight,									   factors[i]->breakOffside.maxWeight,									   RRM_DIRECT);		if (logLevel >= 2)			LOG << " " << breakOffsideWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating passedOppNum weight	float passedOppNumValue = interCalc.getPassedOppPlayers();	if (logLevel >= 2)		LOG << "passedOppNumValue: " << passedOppNumValue << endl			<< "passedOppNumWeight:";	for (unsigned i = 0; i < num; i++)	{		passedOppNumWeight[i] = reRate(passedOppNumValue,									   factors[i]->passedOppNum.minValue,									   factors[i]->passedOppNum.maxValue,									   factors[i]->passedOppNum.minWeight,									   factors[i]->passedOppNum.maxWeight,									   RRM_DIRECT);		if (logLevel >= 2)			LOG << " " << passedOppNumWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating statusShoot weight	float statusShootDir = getShootDirValue(		checkInterPlayer.getInterPoint(), worldModel);	float statusShootDist = hypot(checkInterPlayer.getInterPoint().x - 52.5,								  fmin(checkInterPlayer.getInterPoint().y - 4,									   checkInterPlayer.getInterPoint().y + 4));	float statusShootValue = statusShootDir -		fmax(statusShootDist - 10, 0) * 1.15;	if (logLevel >= 2)		LOG << "statusShootDir: " << statusShootDir << endl			<< "statusShootDist: " << statusShootDist << endl			<< "statusShootValue: " << statusShootValue << endl			<< "statusShootWeight:";	for (unsigned i = 0; i < num; i++)	{		statusShootWeight[i] = reRate(statusShootValue,									  factors[i]->statusShoot.minValue,									  factors[i]->statusShoot.maxValue,									  factors[i]->statusShoot.minWeight,									  factors[i]->statusShoot.maxWeight,									  RRM_DIRECT);		if (logLevel >= 2)			LOG << " " << statusShootWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating dribblePath weight	dribblePath.setBeginPoint(checkInterPlayer.getInterPoint());	dribblePath.setDefaultParams();	float dribblePathValue = dribblePath.getBestTargetWeight();	if (logLevel >= 2)		LOG << "dribblePathValue: " << dribblePathValue << endl			<< "dribblePathWeight:";	for (unsigned i = 0; i < num; i++)	{		dribblePathWeight[i] = 0;		if (logLevel >= 2)			LOG << " " << dribblePathWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating posDev weight	float posDevValue = checkInterPlayer.getPlayer().getPosDeviation() *		checkInterPlayer.getPlayer().getPosDeviation();	if (logLevel >= 2)		LOG << "posDevValue: " << posDevValue << endl			<< "posDevWeight:";	for (unsigned i = 0; i < num; i++)	{		posDevWeight[i] = reRate(posDevValue,								 factors[i]->posDev.minValue, factors[i]->posDev.maxValue,								 factors[i]->posDev.minWeight, factors[i]->posDev.maxWeight,								 RRM_REVERSE);		if (logLevel >= 2)			LOG << " " << posDevWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating ballDist weight	float ballDistValue = interCalc.getFirstBall().		getDistance(checkInterPlayer.getInterPoint());	if (logLevel >= 2)		LOG << "ballDistValue: " << ballDistValue << endl			<< "ballDistWeight:";	for (unsigned i = 0; i < num; i++)	{		ballDistWeight[i] = reRate(ballDistValue,								   factors[i]->ballDist.minValue, factors[i]->ballDist.maxValue,								   factors[i]->ballDist.minWeight, factors[i]->ballDist.maxWeight,								   RRM_REVERSE);		if (logLevel >= 2)			LOG << " " << ballDistWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating dashDist weight	float dashDistValue = checkInterPlayer.getDashDist();	if (logLevel >= 2)		LOG << "dashDistValue: " << dashDistValue << endl			<< "dashDistWeight:";	for (unsigned i = 0; i < num; i++)	{		dashDistWeight[i] = reRate(dashDistValue, 								   factors[i]->dashDist.minValue, factors[i]->dashDist.maxValue, 								   factors[i]->dashDist.minWeight, factors[i]->dashDist.maxWeight, 								   RRM_REVERSE);		if (logLevel >= 2)			LOG << " " << dashDistWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating securityDeltaCycle weight	unsigned securityDeltaCycleValue = checkInterPlayer.getInterTime() -		interCalc.getFastestInterPlayer().getInterTime();	if (logLevel >= 2)		LOG << "TarPlyGTBTime: " << checkInterPlayer.getInterTime() << endl			<< "FastestGTBTime: "			<< interCalc.getFastestInterPlayer().getInterTime() << endl			<< "securityDeltaCycleValue: " << securityDeltaCycleValue << endl			<< "securityDeltaCycleWeight:";	for (unsigned i = 0; i < num; i++)	{		securityDeltaCycleWeight[i] = reRate(securityDeltaCycleValue,											 factors[i]->securityDeltaCycle.minValue,											 factors[i]->securityDeltaCycle.maxValue,											 factors[i]->securityDeltaCycle.minWeight,											 factors[i]->securityDeltaCycle.maxWeight, RRM_REVERSE);		if (logLevel >= 2)			LOG << " " << securityDeltaCycleWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating seeInfo weight	float passAngle = interCalc.getFirstBall().getVel().getDirection();	float avgSeenBefore = worldModel->getSeeDeltaCycle(passAngle, 0.3);	float seeInfoValue = 0.333 * (avgSeenBefore * avgSeenBefore) +		avgSeenBefore;	if (logLevel >= 2)		LOG << "AvgSeenBefore: " << avgSeenBefore << endl			<< "SeeInfoValue: " << seeInfoValue << endl			<< "SeeInfoWeight:";	for (unsigned i = 0; i < num; i++)	{		seeInfoWeight[i] = reRate(seeInfoValue,								  factors[i]->seeInfo.minValue, factors[i]->seeInfo.maxValue,								  factors[i]->seeInfo.minWeight, factors[i]->seeInfo.maxWeight,								  RRM_REVERSE);		if (logLevel >= 2)			LOG << " " << seeInfoWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating defenseLine weight	float defenseLineValue = checkInterPlayer.getInterPoint().x -		worldModel->getTmmDefenseLine();	if (logLevel >= 2)		LOG << "defenseLineValue: " << defenseLineValue << endl			<< "defenseLineWeight:";	for (unsigned i = 0; i < num; i++)	{		defenseLineWeight[i] = reRate(defenseLineValue,									  factors[i]->defenseLine.minValue,									  factors[i]->defenseLine.maxValue,									  factors[i]->defenseLine.minWeight,									  factors[i]->defenseLine.maxWeight,									  RRM_DIRECT);		if (logLevel >= 2)			LOG << " " << defenseLineWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating extraCatch weight	float extraCatchValue = 0;	if (logLevel >= 2)		LOG << "extraCatchValue: " << extraCatchValue << endl			<< "extraCatchWeight:";	for (unsigned i = 0; i < num; i++)	{		extraCatchWeight[i] = reRate(extraCatchValue,									 factors[i]->extraCatch.minValue,									 factors[i]->extraCatch.maxValue,									 factors[i]->extraCatch.minWeight,									 factors[i]->extraCatch.maxWeight,									 RRM_DIRECT);		if (logLevel >= 2)			LOG << " " << extraCatchWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating plan weight	if (logLevel >= 2)		LOG << "planInfo: " << interCalc.getKickPlayer()->getUniNum()			<< " --> " << checkInterPlayer.getPlayer().getUniNum() << endl			<< "planWeight:";	for (unsigned i = 0; i < num; i++)	{		planWeight[i] = getPlanWeight(interCalc.getKickPlayer()->getUniNum(),									  checkInterPlayer.getPlayer().getUniNum(),									  interCalc.getFirstBall().getPos());		if (logLevel >= 2)			LOG << " " << planWeight[i];	}	if (logLevel >= 2)		LOG << endl;	// calculating Current weight	if (logLevel >= 1)		LOG << "P" << checkInterPlayer.getPlayer().getUniNum()			<< "\tPoint: " << checkInterPlayer.getInterPoint()			<< "\t\tweights:";	for (unsigned i = 0; i < num; i++)	{		*valuesList[i] =			offenseWeight[i] +			statusShootWeight[i] +			statusOppNumWeight[i] +			statusOppDistWeight[i] +			statusOppDirWeight[i] +			breakOffsideWeight[i] +			passedOppNumWeight[i] +			statusShootWeight[i] +			dribblePathWeight[i] +			ballDistWeight[i] +			dashDistWeight[i] +			posDevWeight[i] +			seeInfoWeight[i] +			securityDeltaCycleWeight[i] +			defenseLineWeight[i] +			extraCatchWeight[i] +			planWeight[i];		if (logLevel >= 1)			LOG << "\t" << *valuesList[i];	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -