本文整理汇总了C++中WorldModel::dirCount方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldModel::dirCount方法的具体用法?C++ WorldModel::dirCount怎么用?C++ WorldModel::dirCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldModel
的用法示例。
在下文中一共展示了WorldModel::dirCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/*!
*/
void
ShootGenerator::createShoot( const WorldModel & wm,
const Vector2D & target_point )
{
const AngleDeg ball_move_angle = ( target_point - M_first_ball_pos ).th();
const PlayerObject * goalie = wm.getOpponentGoalie();
if ( goalie
&& 5 < goalie->posCount()
&& goalie->posCount() < 30
&& wm.dirCount( ball_move_angle ) > 3 )
{
#ifdef DEBUG_PRINT
dlog.addText( Logger::SHOOT,
"%d: __ xxx goalie_count=%d, low dir accuracy",
M_total_count,
goalie->posCount() );
#endif
return;
}
const ServerParam & SP = ServerParam::i();
const double ball_speed_max = ( wm.gameMode().type() == GameMode::PlayOn
|| wm.gameMode().isPenaltyKickMode()
? SP.ballSpeedMax()
: wm.self().kickRate() * SP.maxPower() );
const double ball_move_dist = M_first_ball_pos.dist( target_point );
const Vector2D max_one_step_vel
= ( wm.self().isKickable()
? KickTable::calc_max_velocity( ball_move_angle,
wm.self().kickRate(),
wm.ball().vel() )
: ( target_point - M_first_ball_pos ).setLengthVector( 0.1 ) );
const double max_one_step_speed = max_one_step_vel.r();
double first_ball_speed
= std::max( ( ball_move_dist + 5.0 ) * ( 1.0 - SP.ballDecay() ),
std::max( max_one_step_speed,
1.5 ) );
bool over_max = false;
#ifdef DEBUG_PRINT_FAILED_COURSE
bool success = false;
#endif
while ( ! over_max )
{
if ( first_ball_speed > ball_speed_max - 0.001 )
{
over_max = true;
first_ball_speed = ball_speed_max;
}
if ( createShoot( wm,
target_point,
first_ball_speed,
ball_move_angle,
ball_move_dist ) )
{
Course & course = M_courses.back();
if ( first_ball_speed <= max_one_step_speed + 0.001 )
{
course.kick_step_ = 1;
}
#ifdef DEBUG_PRINT_SUCCESS_COURSE
dlog.addText( Logger::SHOOT,
"%d: ok shoot target=(%.2f %.2f)"
" speed=%.3f angle=%.1f",
M_total_count,
target_point.x, target_point.y,
first_ball_speed,
ball_move_angle.degree() );
dlog.addRect( Logger::SHOOT,
target_point.x - 0.1, target_point.y - 0.1,
0.2, 0.2,
"#00ff00" );
char num[8];
snprintf( num, 8, "%d", M_total_count );
dlog.addMessage( Logger::SHOOT,
target_point, num, "#ffffff" );
#endif
#ifdef DEBUG_PRINT_FAILED_COURSE
success = true;
#endif
#ifdef SEARCH_UNTIL_MAX_SPEED_AT_SAME_POINT
if ( course.goalie_never_reach_
&& course.opponent_never_reach_ )
{
return;
}
++M_total_count;
#else
return;
//.........这里部分代码省略.........