Skip to content
Browse files

Merge branch 'master' of github.com:norm2782/HaskBan

  • Loading branch information...
2 parents 0d92e5e + a09de75 commit 0e51e5b4cb2e06a81f6eda30a743c282128a0ceb @roman roman committed Aug 26, 2010
Showing with 8 additions and 3 deletions.
  1. +8 −3 HaskBan/Logic.hs
View
11 HaskBan/Logic.hs
@@ -31,16 +31,21 @@ module HaskBan.Logic where
isPath :: Point -> SokoMap -> Bool
isPath = isCellType (Path Empty)
+ isTarget :: Point -> SokoMap -> Bool
+ isTarget p sm = isCellType (Target Box) p sm ||
+ isCellType (Target Empty) p sm
+
isCellType :: CellType -> Point -> SokoMap -> Bool
isCellType cType point sMap = (sMap ! point) == cType
-- Verify if the player can move to the point that is provided.
-- In case the new pointis a box, the next position needs to be
-- checked as well. Hence, the original translation function is provided as well.
canMoveTo :: SokoMap -> Point -> Translation -> Bool
- canMoveTo sMap point transl = (isPath point sMap) ||
- (isBox point sMap && not (isWall trPt sMap)
- && not (isBox trPt sMap))
+ canMoveTo sMap point transl = (isPath point sMap) ||
+ (isTarget point sMap) ||
+ (isBox point sMap && not (isWall trPt sMap)
+ && not (isBox trPt sMap))
where trPt = transl point

0 comments on commit 0e51e5b

Please sign in to comment.
Something went wrong with that request. Please try again.