1 implementation module Team_Opponent_Keeper_Assignment
4 from KeeperChallenger import keeperChallenger
6 Team_Opponent_Keeper :: !Home FootballField -> Team
7 Team_Opponent_Keeper home field
8 = getFielders club home field
10 club = base_TeamName_Opponent_Keeper +++ if (home==West) "_W" "_E"
12 base_TeamName_Opponent_Keeper :: String
13 base_TeamName_Opponent_Keeper = "Opp_Keeper"
15 getFielders :: String Home FootballField -> [Footballer]
16 getFielders club home field
17 # chal1 = {keeperChallenger {clubName=club,playerNr=2} & pos = {px=west_edge + scale 0.025 field.flength,py=scale 0.20 field.fwidth}
18 , speed = {(keeperChallenger {clubName=club,playerNr=2}).speed & direction = rad (1.4*pi)}
20 # chal2 = {keeperChallenger {clubName=club,playerNr=3} & pos = {px=west_edge + scale 0.060 field.flength,py=scale 0.15 field.fwidth}}
21 # chal3 = {keeperChallenger {clubName=club,playerNr=4} & pos = {px=west_edge + scale 0.080 field.flength,py=scale 0.00 field.fwidth}
22 , speed = {(keeperChallenger {clubName=club,playerNr=4}).speed & direction = rad (0.0*pi)}
24 # chal4 = {keeperChallenger {clubName=club,playerNr=5} & pos = {px=west_edge + scale 0.060 field.flength,py=scale -0.15 field.fwidth}}
25 # chal5 = {keeperChallenger {clubName=club,playerNr=6} & pos = {px=west_edge + scale 0.025 field.flength,py=scale -0.20 field.fwidth}
26 , speed = {(keeperChallenger {clubName=club,playerNr=6}).speed & direction = rad (0.6*pi)}
28 # fielders = [chal1,chal2,chal3,chal4,chal5]
29 # fielders = map (mirrorDirection home) fielders
30 | home == East = fielders
31 | otherwise = mirror field fielders
33 west_edge = scale -0.5 field.flength
35 mirrorDirection :: !Home !Footballer -> Footballer
36 mirrorDirection home fielder
37 = {fielder & speed = {fielder.speed & direction = if (d > rad pi) (d - rad pi) (d + rad pi)}}
39 d = fielder.speed.direction