| any (isPauseGame) referee || any (isGameOver) referee = halt (x, mm)\r
// Keeper\r
| me.playerID.playerNr == 1\r
- | i_have_ball = kickTarget (x, mm)\r
+ | i_have_ball = kick closest_free_teammate (x, mm)\r
| ball_in_reach maxCatchReach = (CatchBall, mm)\r
| ball_their_half = halt (x, mm)\r
| ball_within_16\r
| ball_their_half = fix {origpos & px=origpos.px + (scale 0.5 ballPos.pxy.px)} prec (x, mm)\r
| otherwise\r
// TODO I have the ball\r
- | i_have_ball = halt (x, mm)\r
+ | i_have_ball = moveForward i (x, mm)\r
// TODO we have the ball\r
- | we_have_ball = halt (x, mm)\r
- // TODO they have the ball\r
- | otherwise = halt (x, mm)\r
+ | we_have_ball = fix {px=ballPos.pxy.px, py=origpos.py} prec (x, mm)\r
+ // they have the ball\r
+ | otherwise = obtainBall i (x, mm)\r
// Attacker\r
| otherwise\r
- | i_have_ball = kickTarget (x, mm)\r
+ | i_have_ball = moveForward i (x, mm)\r
| ballIsFree football\r
| ball_in_reach maxGainReach = (GainBall, mm)\r
| isClosest us me ballPos.pxy = fix ballPos.pxy prec (x, mm)\r
| otherwise = fix {px=ballPos.pxy.px + (m 10.0), py=origpos.py} prec (x, mm) \r
| we_have_ball = fix {px=ballPos.pxy.px + (m 10.0), py=origpos.py} prec (x, mm)\r
- | otherwise\r
- | ball_in_reach maxTackleReach\r
- | i<15 = (Tackle (hd has_ball).playerID (ms 6.0), mm)\r
- | otherwise = (GainBall, mm)\r
- | isClosest us me ballPos.pxy = fix ballPos.pxy prec (x, mm)\r
- // TODO get to a free player\r
- | otherwise = halt (x, mm)\r
+ | otherwise = obtainBall i (x, mm)\r
where\r
+ obtainBall :: Int -> FootballerAI m\r
+ obtainBall i\r
+ | ball_in_reach maxTackleReach && length has_ball > 0\r
+ | i<15 = \(_,mm).(Tackle (hd has_ball).playerID (ms 10.0), mm)\r
+ | i < 50 = kick closest_free_teammate\r
+ | otherwise = \(_,mm).(GainBall, mm)\r
+ | isClosest us me ballPos.pxy = fix ballPos.pxy prec\r
+ | otherwise = fix closest_free_player prec\r
+\r
+ moveForward :: Int -> FootballerAI m\r
+ moveForward i = fix their_goal prec//TODO\r
+ \r
stayInGoal = fix (attract goal_area_depth our_goal ballPos.pxy) prec\r
- kickTarget = kick their_goal //TODO\r
+ closest_free_player = their_goal // TODO\r
+ closest_free_teammate = their_goal // TODO\r
\r
player_within_16 p = inPenaltyArea field home p.pos\r
ball_within_16 = inPenaltyArea field home ballPos.pxy\r