Rasenschach 0.1 → 0.1.1
raw patch · 6 files changed
+31/−17 lines, 6 files
Files
- Helper.hs +1/−1
- ObjectBehaviour.hs +4/−3
- ParseTeam.hs +11/−12
- PlayerFSM.hs +7/−0
- Rasenschach.cabal +1/−1
- Rules.hs +7/−0
Helper.hs view
@@ -340,7 +340,7 @@ comToMsg (CmdPassHigh dt) = [pm (PPTLoseMe, BSPPass dt RTHigh Nothing)] comToMsg (CmdPassLow dt) = [pm (PPTLoseMe, BSPPass dt RTLow Nothing)] comToMsg CmdFlipHigh = [pm (PPTLoseMe, BSPPass 1 RTHigh Nothing)]-comToMsg CmdFlipLow = [pm (PPTLoseMe, BSPPass 1 RTLow Nothing)]+comToMsg CmdFlipLow = [pm (PPTLoseMe, BSPPass 1 RTLow Nothing)] --comToMsg pos CmdMoveForward = [tm (TPTMoveTo, TacticalStateParam (Just $ pos .+^ vector2 0 (-20)) -- Nothing False Nothing -- Nothing Nothing)]
ObjectBehaviour.hs view
@@ -337,9 +337,10 @@ bc <- fetchBallCarrier vss guard $ vsTeam bc == myTeam let hisPos = projectP $ vsPos bc- return (vsObjId bc, tm (TPTKickTowards,- (TacticalStateParam Nothing (Just $ (myPos .-. hisPos) ^+! 0) False (Just me)- Nothing (Just kickType) Nothing)))+-- return (vsObjId bc, tm (TPTKickTowards,+-- (TacticalStateParam Nothing (Just $ (myPos .-. hisPos) ^+! 0) False (Just me)+-- Nothing (Just kickType) Nothing)))+ return (vsObjId bc, pm (PPTLoseMe, BSPPass 1 kickType (Just me))) getKickType mc = if cmdFlipMeLow mc then Just RTLow
ParseTeam.hs view
@@ -178,15 +178,14 @@ send msgIntercept np ballSpot\n \ \n \ rule pass_to_free priority 5\n \- att is factAttacking\n \- me is factWhoAmI\n \- check factEq att me\n \- bcId is factBallCarrier\n \- bcSpot is factPlayerSpot bcId\n \- bcValue is factSpotValue bcSpot\n \- recId is factBestFreePlayer\n \- recSpot is factPlayerSpot recId\n \- recValue is factSpotValue recSpot\n \- check factGT recValue bcValue\n \- passVector is factGetVector bcSpot recSpot\n \-send msgKick bcId passVector"+ att is factAttacking\n \+ me is factWhoAmI\n \+ check factEq att me\n \+ bcId is factBallCarrier\n \+ bcSpot is factPlayerSpot bcId\n \+ bcValue is factSpotValue bcSpot\n \+ recId is factBestFreePlayer\n \+ recSpot is factPlayerSpot recId\n \+ recValue is factSpotValue recSpot\n \+ check factGT recValue bcValue\n \+send msgPassTo bcId recId"
PlayerFSM.hs view
@@ -286,6 +286,13 @@ let dir = atan2 (vector3Y vd) (vector3X vd) in [(me, tm (TPTWait, TacticalStateParam Nothing mvd False rec (Just dir) kt Nothing))]+turnTowards ((TacticalStateParam _ _ _ mr@(Just rec) _ kt _), (_, me, vss, _)) =+ let recPos = vsPos $ fetchVS vss rec+ myPos = vsPos $ fetchVS vss me+ vd = myPos .-. recPos+ dir = atan2 (vector3Y vd) (vector3X vd)+ in [(me, tm (TPTWait,+ TacticalStateParam Nothing Nothing False mr Nothing kt Nothing))] kickTowards ((TacticalStateParam _ mvd@(Just vd) _ Nothing _ _ _), (_, me, vss, _)) = [(me, pm (PPTLoseMe, BSPShoot vd))]
Rasenschach.cabal view
@@ -1,5 +1,5 @@ name: Rasenschach-version: 0.1+version: 0.1.1 cabal-version: >=1.2 build-type: Simple license: BSD3
Rules.hs view
@@ -328,6 +328,7 @@ else Right () checkMsg "msgKick" = Right msgKick+checkMsg "msgPassTo" = Right msgPassTo checkMsg "msgIntercept" = Right msgIntercept checkMsg x = Left (3, "no valid message: " ++ x) @@ -358,6 +359,12 @@ [(ballCarrier, tm (TPTKickTowards, (TacticalStateParam Nothing (Just goalVector) False Nothing Nothing Nothing Nothing)))]++msgPassTo :: MsgMaker+msgPassTo _ [FPPlayerId ballCarrier, FPPlayerId receiver] =+ [(ballCarrier, tm (TPTKickTowards,+ (TacticalStateParam Nothing Nothing False+ (Just receiver) Nothing (Just RTLow) Nothing)))] msgIntercept :: MsgMaker msgIntercept _ [FPPlayerId np, FPSpot p1] =