From 2d35e081d8964032974423e16882f4ee985feb2f Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Wed, 17 Jun 2015 15:55:21 +0200 Subject: [PATCH] they walk with me --- src/StdTeam/Team_Student_Rounds_Assignment.icl | 0 src/Team_MartLubbers.icl | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) mode change 100755 => 100644 src/StdTeam/Team_Student_Rounds_Assignment.icl diff --git a/src/StdTeam/Team_Student_Rounds_Assignment.icl b/src/StdTeam/Team_Student_Rounds_Assignment.icl old mode 100755 new mode 100644 diff --git a/src/Team_MartLubbers.icl b/src/Team_MartLubbers.icl index b1fbd41..58be5ed 100644 --- a/src/Team_MartLubbers.icl +++ b/src/Team_MartLubbers.icl @@ -69,12 +69,19 @@ closerToGoal East = (<) closerToGoal West = (>) mind :: !FootballField !(!BrainInput, !Mem) -> (!BrainOutput, !Mem) -mind field (x=:{referee,football,others,me}, mm=:{home}) -# others = (me team others) -| isClosest others me (getBall x).ballPos.pxy = (afterfix (kick nextPos) (getBall x).ballPos.pxy (maxKickReach me)) (x, mm) -| otherwise = halt (x, mm) +mind field (x=:{referee,football,others,me}, mm=:{home,origpos}) +| ballIsGainedBy me.playerID football + | me.stamina > 0.5 = fix nextPos (m 1.0) (x, mm) + | otherwise = kick nextPos (x, mm) +| isClosest others me ballPos.pxy = afterfix (\(_, m).(GainBall, m)) ballPos.pxy (scale 0.5 (maxKickReach me)) (x, mm) +| otherwise + | we_have_ball = fix {px=min ballPos.pxy.px (field.flength-me.pos.px), py=me.pos.py} (m 1.0) (x, mm) + | otherwise = fix origpos (m 1.0) (x, mm) where - nextPos = let np = nextPlayer home others me.pos in if (isNothing np) (centerOfGoal (other home) field) (fromJust np) + us = me team others + ballPos = (getBall x).ballPos + nextPos = let np = nextPlayer home us me.pos in if (isNothing np) (centerOfGoal (other home) field) (fromJust np) + we_have_ball = or (map (\x.ballIsGainedBy x.playerID football) us) nextPlayer :: !Home [Footballer] Position -> Maybe Position nextPlayer home xs pos -- 2.20.1