void restartGame(){ xa = 0; condicao = 0; ya = 26; it = 0; al = 0; formation(); }
void configAll(){ allegro_init(); install_timer(); install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,"OK"); install_keyboard(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,1000,800,0,0); formation(); }
void BehaviorFormationPlanner::Plan(std::list<ActiveBehavior> & behavior_list) { ActiveBehavior formation(mAgent, BT_Formation); formation.mBuffer = 1.0; formation.mPower = mSelfState.CorrectDashPowerForStamina(ServerParam::instance().maxDashPower()); formation.mTarget = mAnalyser.mHome[mSelfState.GetUnum()]; if(formation.mTarget.X() < mSelfState.GetPos().X() && mAgent.GetFormation().GetMyRole().mLineType == LT_Forward){ formation.mPower = mSelfState.CorrectDashPowerForStamina(ServerParam::instance().maxDashPower())/2; } if(mAgent.GetFormation().GetMyRole().mLineType == LT_Defender){ formation.mTarget.SetX(Min(0.0,formation.mTarget.X())); if(mBallState.GetPos().X() < -25){ Unum goalie = mWorldState.GetTeammateGoalieUnum(); Vector gpos = mWorldState.GetTeammate(goalie).GetPos(); Vector left = (ServerParam::instance().ourLeftGoalPost() + gpos)/2; Vector right = (ServerParam::instance().ourRightGoalPost() + gpos)/2; Line l(gpos,mBallState.GetPos()); if(l.IsPointInSameSide(left,ServerParam::instance().ourGoal())){ const std::vector<Unum> & t2t = mPositionInfo.GetClosePlayerToPoint(left,goalie); if(t2t[0] == mSelfState.GetUnum()){ formation.mTarget = left; } else if(mPositionInfo.GetClosePlayerToPoint(right,t2t[0])[0] == mSelfState.GetUnum()){ formation.mTarget = right; } else if(mPositionInfo.GetClosePlayerToPoint(right,t2t[0])[0] == goalie && mPositionInfo.GetClosePlayerToPoint(right,t2t[0])[1] == mSelfState.GetUnum()){ formation.mTarget = right; } } else { const std::vector<Unum> & t2t = mPositionInfo.GetClosePlayerToPoint(right,goalie); if(t2t[0] == mSelfState.GetUnum()){ formation.mTarget = right; } else if(mPositionInfo.GetClosePlayerToPoint(left,t2t[0])[0] == mSelfState.GetUnum()){ formation.mTarget = left; } else if(mPositionInfo.GetClosePlayerToPoint(left,t2t[0])[0] == goalie && mPositionInfo.GetClosePlayerToPoint(right,t2t[0])[1] == mSelfState.GetUnum()){ formation.mTarget = left; } } } formation.mEvaluation = Evaluation::instance().EvaluatePosition(formation.mTarget, true); } else formation.mEvaluation = Evaluation::instance().EvaluatePosition(formation.mTarget, false); behavior_list.push_back(formation); }
void read_formation() { int i,j;//,k,n; cin >> n >> k; // cout << "n = " << n << '\t' <<"k = " << k << '\n'; f.resize(n,formation(k)); /// cout << "in read"; for(i=0;i<n;++i){ f[i].ballpos.read(); for(j=0;j<k;++j){ // cout << i << ' ' << j << '\n'; f[i].bot_pos[j].read(); } // getchar();getchar(); } update(); // cout << "done read\n"; }