initial team
authorMart Lubbers <mart@martlubbers.net>
Mon, 8 Jun 2015 14:14:06 +0000 (16:14 +0200)
committerMart Lubbers <mart@martlubbers.net>
Mon, 8 Jun 2015 14:14:06 +0000 (16:14 +0200)
src/Game/Team.icl
src/MartLubbers.icl [new file with mode: 0644]
src/SoccerFun.prj
src/Team_MartLubbers.dcl [new file with mode: 0644]
src/Team_MartLubbers.icl [new file with mode: 0644]

index 3b5dcb7..bec99c0 100644 (file)
@@ -13,6 +13,7 @@ import Team_Student_Slalom_Assignment
 import Team_Student_Passing_Assignment
 import Team_Student_DeepPass_Assignment
 import Team_Student_Keeper_Assignment
+import Team_MartLubbers
 
 allAvailableTeams                                      :: [Home FootballField -> Team]
 allAvailableTeams                                      = [ Team_MiniEffies
@@ -25,6 +26,7 @@ allAvailableTeams                                     = [ Team_MiniEffies
                                                                          , Team_Opponent_Passing
                                                                          , Team_Opponent_DeepPass
                                                                          , Team_Opponent_Keeper
+                                                                         , Team_MartLubbers
                                                                          ]
 
 instance nameOf Team where     nameOf players
diff --git a/src/MartLubbers.icl b/src/MartLubbers.icl
new file mode 100644 (file)
index 0000000..65e62bf
--- /dev/null
@@ -0,0 +1,69 @@
+implementation module Team_MartLubbers\r
+\r
+import Footballer\r
+\r
+Team_MartLubbers :: !Home !FootballField -> Team\r
+Team_MartLubbers home field = \r
+|      home==West                              = westTeam\r
+|      otherwise                               = eastTeam\r
+where\r
+       eastTeam                                = mirror field westTeam\r
+       westTeam                                = [keeper : fielders]\r
+       clubname                                = base_TeamName_MiniEffie +++ if (home == West) "W" "E"\r
+       keeper                                  = MiniEffie clubname home field {zero & px=scale -0.5 field.flength} 1\r
+       fielders                                = [  MiniEffie clubname home field {px=scale (-0.5*dx) field.flength,py=scale (0.5*dy) field.fwidth} nr\r
+                                                         \\ (dx,dy) <- west_positions_fielders\r
+                                                          & nr      <- [2..]\r
+                                                         ]\r
+       west_positions_fielders = [(0.20, 0.40)\r
+                                                         ,(0.20,-0.40)\r
+                                                         ,(0.23, 0.00) \r
+                                                         ,(0.50, 0.45)\r
+                                                         ,(0.50,-0.45)\r
+                                                         ,(0.60, 0.00)\r
+                                                         ,(0.70, 0.35)\r
+                                                         ,(0.70,-0.35)\r
+                                                         ,(0.90, 0.05)\r
+                                                         ,(0.90,-0.05)\r
+                                                         ]                                                       \r
+\r
+:: MiniMemory                          = { home :: !Home }\r
+\r
+MiniEffie :: !ClubName !Home !FootballField !Position !PlayersNumber -> Footballer\r
+MiniEffie club home field position nr\r
+       = { playerID                    = {clubName=club,playerNr=nr}\r
+         , name                                = "MiniF." <+++ nr\r
+         , length                              = min_length\r
+         , pos                                 = position\r
+         , nose                                = zero\r
+         , speed                               = zero\r
+         , skills                              = (Running, Kicking, Rotating)\r
+         , effect                              = Nothing\r
+         , stamina                             = max_stamina\r
+         , health                              = max_health\r
+         , brain                               = { memory = {home=home}, ai = minibrain field }\r
+         }       \r
+\r
+minibrain :: !FootballField !(!BrainInput,!MiniMemory) -> (!BrainOutput,!MiniMemory)\r
+minibrain field (input=:{referee,me}, memory=:{home})\r
+| i_am_close_to_the_ball\r
+       | i_can_see goal                = (kick_the_ball,     new_memory)\r
+       | otherwise                             = (turn_to_face goal, new_memory)\r
+| i_can_see ball                       = (run_to_the_ball,   new_memory)\r
+| otherwise                                    = (turn_to_face ball, new_memory)       \r
+where\r
+       new_memory                              = {home=if (any isEndHalf referee) (other home) home}\r
+       my_direction                    = me.nose\r
+       ball                                    = getBall input\r
+       goal                                    = centerOfGoal (other home) field\r
+       \r
+       i_am_close_to_the_ball  = dist me ball < maxKickReach me\r
+       i_can_see pos                   = abs (bearing my_direction me pos) < rad (0.05*pi)\r
+\r
+       run_to_the_ball                 = Move {direction=bearing zero me ball,velocity=speed_of_light} zero\r
+       turn_to_face pos                = Move zero (bearing my_direction me pos)\r
+       kick_the_ball                   = KickBall {vxy={direction=my_direction,velocity=speed_of_light}, vz=ms 1.0}\r
+       speed_of_light                  = ms 299792458.0\r
+\r
+base_TeamName_MiniEffie                :: String\r
+base_TeamName_MiniEffie                = "Æsir"        
\ No newline at end of file
index c1e0db6..bfb80ed 100644 (file)
@@ -46,6 +46,8 @@ Global
                Path:   {Project}\StdLibExt\r
                Path:   {Project}\StdReferee\r
                Path:   {Project}\StdTeam\r
+               Path:   {Project}\r
+               Path:   {Project}\r
        Precompile:     \r
        Postlink:       \r
 MainModule\r
@@ -63,6 +65,20 @@ MainModule
                ReuseUniqueNodes:       True\r
                Fusion: False\r
 OtherModules\r
+       Module\r
+               Name:   Team_MartLubbers\r
+               Dir:    {Project}\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
        Module\r
                Name:   Football\r
                Dir:    {Project}\Game\r
diff --git a/src/Team_MartLubbers.dcl b/src/Team_MartLubbers.dcl
new file mode 100644 (file)
index 0000000..1b84fe8
--- /dev/null
@@ -0,0 +1,5 @@
+definition module Team_MartLubbers\r
+\r
+import Footballer\r
+\r
+Team_MartLubbers :: !Home !FootballField -> Team
\ No newline at end of file
diff --git a/src/Team_MartLubbers.icl b/src/Team_MartLubbers.icl
new file mode 100644 (file)
index 0000000..37db883
--- /dev/null
@@ -0,0 +1,77 @@
+implementation module Team_MartLubbers\r
+\r
+import Footballer\r
+import FootballerFunctions\r
+\r
+Names:: [String]\r
+Names = [\r
+       "Balder",\r
+       "Njord",\r
+//     "Freyr",\r
+       "Freyja",\r
+       "Tyr",\r
+       "Bragi",\r
+       "Heimdall",\r
+       "Hoder",\r
+       "Vidar",\r
+       "Vale",\r
+       "Ullr",\r
+       "Forseti"]\r
+\r
+Team_MartLubbers :: !Home !FootballField -> Team\r
+Team_MartLubbers home field\r
+|      home==West                              = westTeam\r
+|      otherwise                               = eastTeam\r
+where\r
+       eastTeam                                = mirror field westTeam\r
+       westTeam                                = [keeper : fielders]\r
+       clubname                                = base_TeamName_MartLubbers +++ if (home == West) "_W" "_E"\r
+       keeper                                  = Aesir clubname home field {zero & px=scale -0.5 field.flength} 1 "Thor"\r
+       fielders                                = [Aesir clubname home field {px=scale (-0.5*dx) field.flength,py=scale (0.5*dy) field.fwidth} nr name\r
+                                                         \\ (dx,dy) <- west_positions_fielders\r
+                                                          & nr      <- [2..]\r
+                                                          & name    <- Names\r
+                                                         ]\r
+       west_positions_fielders = [(0.20, 0.40)\r
+                                                         ,(0.20,-0.40)\r
+                                                         ,(0.23, 0.00) \r
+                                                         ,(0.50, 0.45)\r
+                                                         ,(0.50,-0.45)\r
+                                                         ,(0.60, 0.00)\r
+                                                         ,(0.70, 0.35)\r
+                                                         ,(0.70,-0.35)\r
+                                                         ,(0.90, 0.05)\r
+                                                         ,(0.90,-0.05)\r
+                                                         ]                                                       \r
+\r
+:: Mem :== Void\r
+\r
+Aesir :: !ClubName !Home !FootballField !Position !PlayersNumber !String -> Footballer\r
+Aesir club home field position nr name\r
+       = { playerID                    = {clubName=club,playerNr=nr}\r
+         , name                                = name +++ "_" <+++ nr\r
+         , length                              = min_length\r
+         , pos                                 = position\r
+         , nose                                = zero\r
+         , speed                               = zero\r
+         , skills                              = (Running, Kicking, Rotating)\r
+         , effect                              = Nothing\r
+         , stamina                             = max_stamina\r
+         , health                              = max_health\r
+         , brain                               = {memory = zero, ai = mind field }\r
+         }       \r
+\r
+mind :: !FootballField !(!BrainInput, !Mem) -> (!BrainOutput, !Mem)\r
+mind field (input, mm)         \r
+\r
+afterfix after point diff (input=:{me}, m)\r
+| d < diff = after (input, m)\r
+| otherwise = (move, m)\r
+       where\r
+               d = dist me point\r
+               a = bearing zero me point\r
+               r = bearing me.nose me point\r
+               v = ms (max 6.0 (toReal d))\r
+\r
+base_TeamName_MartLubbers :: String\r
+base_TeamName_MartLubbers = "Æsir"     
\ No newline at end of file