From aff5660c40dea70635a328a904e30ed34267ac95 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 22 Jun 2015 09:38:03 +0200 Subject: [PATCH] Don't gain after kick --- src/Team_MartLubbers.icl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Team_MartLubbers.icl b/src/Team_MartLubbers.icl index 9a18f19..9537ed1 100644 --- a/src/Team_MartLubbers.icl +++ b/src/Team_MartLubbers.icl @@ -83,8 +83,8 @@ mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) // Keeper | me.playerID.playerNr == 1 | i_have_ball = kick closest_free_teammate (x, mm) - | ball_in_reach maxCatchReach = (CatchBall, mm) - | ball_in_reach maxKickReach = kick closest_free_teammate (x, mm) + | ball_in_reach maxCatchReach && not_previously_kicked = (CatchBall, mm) + | ball_in_reach maxKickReach && not_previously_kicked = kick closest_free_teammate (x, mm) | ball_their_half = halt (x, mm) | ball_within_16 | we_have_ball = stayInGoal (x, mm) @@ -115,7 +115,7 @@ mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) | otherwise | i_have_ball = moveForward i (x, mm) | ballIsFree football - | ball_in_reach maxGainReach = (GainBall, mm) + | ball_in_reach maxGainReach && not_previously_kicked = (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) @@ -128,13 +128,13 @@ mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) | otherwise = \(_,mm).(GainBall, mm) | ball_in_reach maxGainReach = \(_,mm).(GainBall, mm) | isClosest us me ballPos.pxy = fix ballPos.pxy prec - | otherwise = fix (attract prec closest_free_player ballPos.pxy) prec + | otherwise = fix (attract (scale 3.0 prec) closest_free_player ballPos.pxy) prec moveForward :: Int -> FootballerAI m moveForward i = kick closest_free_teammate stayInGoal = fix (attract goal_area_depth our_goal ballPos.pxy) prec - closest_free_player = (closest them me.pos).pos // TODO + closest_free_player = (closest them me.pos).pos closest_free_teammate | length players_closer_to_goal > 0 = (closest players_closer_to_goal me.pos).pos | otherwise = their_goal @@ -143,6 +143,7 @@ mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) player_within_16 p = inPenaltyArea field home p.pos ball_within_16 = inPenaltyArea field home ballPos.pxy + not_previously_kicked = if (isNothing me.effect) True (not (isKickedBall (fromJust me.effect))) has_ball = filter (\x.ballIsGainedBy x.playerID football) others we_have_ball = any (\x.sameClub me x) has_ball they_have_ball = any (\x.not (sameClub me x)) has_ball -- 2.20.1