본문 바로가기

PROFILE/Independent project

Foot Ball Manager - AI Game / C, STL, AI algorithm / Dec. 2009

Title
Foot Ball Manager
Screen capture

 

Genre
Artificial Intelligence Soccer Matching System
period
2009.09~2009.12
Environment
Windows 7, Visual Studio 2008
Skill
C, STL, AI Algorithm
contents
Add Defensive Player, Modify Support (BSS) Calculation Method, Add Status at Team Point, Add Physical Fitness, Fatigue, Full Attack, Defensive Strategy Mode, etc.
Source code
void AttackAll::Execute(FieldPlayer* player) {
     if (player->BallWithinKickingRange()) {                                        // When the ball is near
                player->GetFSM()->ChangeState(KickBall::Instance());     // Changed state to kick
                return;
     }
     if (player->Pitch()->GameOn()){                    // If no one gets the ball first
         if (player->Team()->Receiver() == NULL && !player->Pitch()->GoalKeeperHasBall()) {
                player->Steering()->SeekOn();                  // Looking for the ball's position
                return;
         }
         if ( player->isClosestTeamMemberToBall() && (player->Team()->Receiver() == NULL) && !player->Pitch()->GoalKeeperHasBall()){
                player->GetFSM()->ChangeState(ChaseBall::Instance());   // move to the ball
                return;
         }              // If the team has a ball and there is a ball near the team member
         if (player->Team()->InControl() && player->isClosestTeamMemberToBall()){               
                player->Steering()->PursuitOn();              // Pursue
                return;
         }                               // If the player is near the ball and cannot kick the ball
         if (player->Pitch()->Ball()->BRadius() && !player->BallWithinKickingRange()){
                player->Steering()->PursuitOn();              // Pursue
                return;
         }
         if(player->Team()->InControl()){         // If the team has a ball
                player->Steering()->Force();    // Approach.
                return;
         }
     } }