From 75a7c0ce70f54ee59be3fad89fe568f1c30fcb5c Mon Sep 17 00:00:00 2001 From: Abhinav Sarkar Date: Fri, 10 Jul 2015 01:01:00 +0530 Subject: [PATCH] Hlinted --- src/Hastron/Game/Engine.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Hastron/Game/Engine.hs b/src/Hastron/Game/Engine.hs index 0470baf..da63391 100644 --- a/src/Hastron/Game/Engine.hs +++ b/src/Hastron/Game/Engine.hs @@ -41,7 +41,7 @@ checkTrail GameMap{..} trail = else (trail', PlayerDead) stepGame :: Game -> InEvent -> (Game, [OutEvent]) -stepGame game@Game{gameMap = gameMap@GameMap{..}, ..} inEvent = stepGame' inEvent +stepGame game@Game{gameMap = gameMap@GameMap{..}, ..} = stepGame' where stepGame' (InPlayerTurnLeft playerId) = stepTurnEvent playerId $ moveAfterTurn leftTurn stepGame' (InPlayerTurnRight playerId) = stepTurnEvent playerId $ moveAfterTurn rightTurn @@ -66,10 +66,8 @@ stepGame game@Game{gameMap = gameMap@GameMap{..}, ..} inEvent = stepGame' inEven foldl' (flip Set.insert) gameMapBlockedPoints trail } game' = game { gamePlayers = Map.insert playerId player' gamePlayers , gameMap = gameMap' } - outEvents = [OutPlayerPosition playerId pos' dir'] ++ - (if playerState /= playerState' - then [OutPlayerStateChange playerId playerState'] - else []) + outEvents = OutPlayerPosition playerId pos' dir' : + [OutPlayerStateChange playerId playerState' | playerState /= playerState'] in (game', outEvents) score (x1, y1) (x2, y2) = abs (x1 - x2) + abs (y1 - y2)