From 613ee32024514f122ed9c5a77201d5e6469519e5 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 19 Jun 2015 20:41:36 +0200 Subject: [PATCH] stop looking camil --- src/Team_MartLubbers.icl | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Team_MartLubbers.icl b/src/Team_MartLubbers.icl index 83aa336..d7319bc 100644 --- a/src/Team_MartLubbers.icl +++ b/src/Team_MartLubbers.icl @@ -82,7 +82,7 @@ mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) | any (isPauseGame) referee || any (isGameOver) referee = halt (x, mm) // Keeper | me.playerID.playerNr == 1 - | i_have_ball = kickTarget (x, mm) + | i_have_ball = kick closest_free_teammate (x, mm) | ball_in_reach maxCatchReach = (CatchBall, mm) | ball_their_half = halt (x, mm) | ball_within_16 @@ -103,29 +103,36 @@ mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) | ball_their_half = fix {origpos & px=origpos.px + (scale 0.5 ballPos.pxy.px)} prec (x, mm) | otherwise // TODO I have the ball - | i_have_ball = halt (x, mm) + | i_have_ball = moveForward i (x, mm) // TODO we have the ball - | we_have_ball = halt (x, mm) - // TODO they have the ball - | otherwise = halt (x, mm) + | we_have_ball = fix {px=ballPos.pxy.px, py=origpos.py} prec (x, mm) + // they have the ball + | otherwise = obtainBall i (x, mm) // Attacker | otherwise - | i_have_ball = kickTarget (x, mm) + | i_have_ball = moveForward i (x, mm) | ballIsFree football | ball_in_reach maxGainReach = (GainBall, mm) | isClosest us me ballPos.pxy = fix ballPos.pxy prec (x, mm) | otherwise = fix {px=ballPos.pxy.px + (m 10.0), py=origpos.py} prec (x, mm) | we_have_ball = fix {px=ballPos.pxy.px + (m 10.0), py=origpos.py} prec (x, mm) - | otherwise - | ball_in_reach maxTackleReach - | i<15 = (Tackle (hd has_ball).playerID (ms 6.0), mm) - | otherwise = (GainBall, mm) - | isClosest us me ballPos.pxy = fix ballPos.pxy prec (x, mm) - // TODO get to a free player - | otherwise = halt (x, mm) + | otherwise = obtainBall i (x, mm) where + obtainBall :: Int -> FootballerAI m + obtainBall i + | ball_in_reach maxTackleReach && length has_ball > 0 + | i<15 = \(_,mm).(Tackle (hd has_ball).playerID (ms 10.0), mm) + | i < 50 = kick closest_free_teammate + | otherwise = \(_,mm).(GainBall, mm) + | isClosest us me ballPos.pxy = fix ballPos.pxy prec + | otherwise = fix closest_free_player prec + + moveForward :: Int -> FootballerAI m + moveForward i = fix their_goal prec//TODO + stayInGoal = fix (attract goal_area_depth our_goal ballPos.pxy) prec - kickTarget = kick their_goal //TODO + closest_free_player = their_goal // TODO + closest_free_teammate = their_goal // TODO player_within_16 p = inPenaltyArea field home p.pos ball_within_16 = inPenaltyArea field home ballPos.pxy -- 2.20.1