rounds done
[fp1415-soccerfun.git] / src / StdTeam / Team_Student_Rounds_Assignment.icl
1 implementation module Team_Student_Rounds_Assignment
2
3 /** Implement a solution to the rounds running assignment.
4
5 Your team consists of one player.
6 Below you only need to change the definition of footballer to your solution.
7 Do not change the position and player identification.
8 Do not change the implementation of base_TeamName_Student_Rounds.
9 */
10 import Footballer
11 import FootballerFunctions
12
13 Team_Student_Rounds :: !Home !FootballField -> Team
14 Team_Student_Rounds home field = if (home == West) team (mirror field team)
15 where
16 team = [ {footballer {clubName=club,playerNr=nr} & pos = toPosition (scale x field.flength,scale y field.fwidth)}
17 \\ (x,y) <- positions
18 & nr <- [2..]
19 ]
20 club = base_TeamName_Student_Rounds +++ if (home==West) "_W" "_E"
21 positions = [(-0.49,0.00)]
22 footballer playerID = {defaultFootballer playerID & name = "Peter88", brain = {memory = Void, ai = mind field}}
23
24 base_TeamName_Student_Rounds :: String
25 base_TeamName_Student_Rounds = "Student Rounds"
26
27 mind :: !FootballField !(!BrainInput, !Void) -> (!BrainOutput, !Void)
28 mind field (i=:{me}, mm)
29 | y >= (t -o) && x > (~r+o) = (fix {px= ~r,py= t} c) (i, mm)
30 | x <= (~r+o) && y > (~t+o) = (fix {px= ~r,py= ~t} c) (i, mm)
31 | y <= (~t+o) && x < (r -o) = (fix {px= r, py= ~t} c) (i, mm)
32 | x >= (r -o) && y < (t -o) = (fix {px= r, py= t} c) (i, mm)
33 where
34 (x, y, o, c) = (me.pos.px, me.pos.py, m 4.0, m 1.5)
35 t = scale 0.5 field.fwidth
36 r = scale 0.5 field.flength