team = [{footballer {clubName=club,playerNr=2} & pos = if (home == West) position (mirror field position)}]\r
club = base_TeamName_Student_Slalom +++ if (home == West) "_W" "_E"\r
position = {zero & px = scale -0.5 field.flength + penalty_area_depth}\r
- footballer player_id = defaultFootballer player_id // implement your footballer here\r
+ footballer player_id = {defaultFootballer player_id & name = "Peter88", brain = {memory = Void, ai = mind field home}}\r
\r
base_TeamName_Student_Slalom :: String\r
base_TeamName_Student_Slalom = "Student Slalom"\r
+\r
+mind :: !FootballField !Home !(!BrainInput, !Void) -> (!BrainOutput, !Void)\r
+mind field home (x=:{me,others}, mm) = (fix {px=pp2 cp.px (m 2.5), py=up cp.py (m 3.5)} (m 1.0)) (x, mm)\r
+ where\r
+ (comparator, pp1, pp2, targetsig) = if (home == West) ((<), (-), (+), (\w.w)) ((>), (+), (-), (~))\r
+ sf = sortBy (\x y.comparator x.pos.px y.pos.px) others\r
+ (cp, up) = closestPos (zip2 [1..] sf) (pp1 me.pos.px xWidthFootballer) {px=targetsig (scale 0.5 field.flength), py=(m 0.0)} comparator\r
+ \r
+closestPos :: [(Int, Footballer)] Metre Position (Metre Metre -> Bool) -> (Position, (Metre Metre -> Metre))\r
+closestPos [] _ d _ = (d, (+))\r
+closestPos [(i, x):xs] p d c\r
+| c p x.pos.px = (x.pos, if (i rem 2 == 0) (+) (-))\r
+| otherwise = closestPos xs p d c\r