From 99e696d56e51f0280af31639f71623a6fe49ba82 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 8 Jun 2015 12:11:37 +0200 Subject: [PATCH] slalom done, need to clean up --- src/SoccerFun.prj | 2 +- src/SoccerFun_options.txt | 0 src/StdTeam/Team_Student_Slalom_Assignment.icl | 15 ++++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/SoccerFun_options.txt mode change 100644 => 100755 src/StdTeam/Team_Student_Slalom_Assignment.icl diff --git a/src/SoccerFun.prj b/src/SoccerFun.prj index daf6db4..c1e0db6 100755 --- a/src/SoccerFun.prj +++ b/src/SoccerFun.prj @@ -1,7 +1,7 @@ Version: 1.4 Global ProjectRoot: . - Built: False + Built: True Target: SoccerFun64 Exec: {Project}\SoccerFun.exe CodeGen diff --git a/src/SoccerFun_options.txt b/src/SoccerFun_options.txt old mode 100644 new mode 100755 diff --git a/src/StdTeam/Team_Student_Slalom_Assignment.icl b/src/StdTeam/Team_Student_Slalom_Assignment.icl old mode 100644 new mode 100755 index a77671d..94bf10c --- a/src/StdTeam/Team_Student_Slalom_Assignment.icl +++ b/src/StdTeam/Team_Student_Slalom_Assignment.icl @@ -17,7 +17,20 @@ where team = [{footballer {clubName=club,playerNr=2} & pos = if (home == West) position (mirror field position)}] club = base_TeamName_Student_Slalom +++ if (home == West) "_W" "_E" position = {zero & px = scale -0.5 field.flength + penalty_area_depth} - footballer player_id = defaultFootballer player_id // implement your footballer here + footballer player_id = {defaultFootballer player_id & name = "Peter88", brain = {memory = Void, ai = mind field home}} base_TeamName_Student_Slalom :: String base_TeamName_Student_Slalom = "Student Slalom" + +mind :: !FootballField !Home !(!BrainInput, !Void) -> (!BrainOutput, !Void) +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) + where + (comparator, pp1, pp2, targetsig) = if (home == West) ((<), (-), (+), (\w.w)) ((>), (+), (-), (~)) + sf = sortBy (\x y.comparator x.pos.px y.pos.px) others + (cp, up) = closestPos (zip2 [1..] sf) (pp1 me.pos.px xWidthFootballer) {px=targetsig (scale 0.5 field.flength), py=(m 0.0)} comparator + +closestPos :: [(Int, Footballer)] Metre Position (Metre Metre -> Bool) -> (Position, (Metre Metre -> Metre)) +closestPos [] _ d _ = (d, (+)) +closestPos [(i, x):xs] p d c +| c p x.pos.px = (x.pos, if (i rem 2 == 0) (+) (-)) +| otherwise = closestPos xs p d c -- 2.20.1