packages feed

haskellscrabble 2.0.1 → 2.1.1

raw patch · 2 files changed

+13/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

haskellscrabble.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                haskellscrabble-version:             2.0.1+version:             2.1.1 synopsis:            A scrabble library capturing the core game logic of scrabble. description:         A scrabble library which enforces legal transitions between moves. Intended to facilitate the development of a playable game. homepage:            http://www.github.com/happy0/haskellscrabble
src/Wordify/Rules/Pos.hs view
@@ -20,25 +20,25 @@   data Direction = Horizontal | Vertical deriving Eq    posMin :: Int-  posMin = 1 +  posMin = 1    posMax :: Int-  posMax = 15 +  posMax = 15    posAt :: (Int, Int) -> Maybe Pos   posAt = flip Map.lookup posMap    -- | The position above the given position, if it exists.   above :: Pos -> Maybe Pos-  above (Pos x y _) = posAt (x,y + 1) +  above (Pos x y _) = posAt (x,y + 1)    -- | The position below the given position, if it exists.   below :: Pos -> Maybe Pos-  below (Pos x y _) = posAt (x, y - 1 ) +  below (Pos x y _) = posAt (x, y - 1 )    -- | The position to the left of the given position, if it exists.   left :: Pos -> Maybe Pos-  left (Pos x y _) = posAt (x - 1, y) +  left (Pos x y _) = posAt (x - 1, y)    -- | The position to the right of the given position, if it exists.   right :: Pos -> Maybe Pos@@ -48,6 +48,12 @@   starPos :: Pos   starPos = Pos 8 8 "H8" +  direction :: Pos -> Pos -> Maybe Direction+  direction startPos endPos+    | xPos startPos == xPos endPos = Just Horizontal+    | yPos startPos == yPos endPos = Just Vertical+    | otherwise = Nothing+   {- A map keyed by tuples representing (x,y) co-ordinates, and valued by their   corresponding Pos types -}   posMap :: Map.Map (Int, Int) Pos@@ -55,7 +61,7 @@       where           coordTuples = zipWith makeTuple (sequence [[posMin..posMax], [posMin..posMax]]) $ cycle ['A'..'O']           makeTuple (x:y:_) gridLetter = Just $ ((y,x) , Pos y x (gridLetter : show x) )-          makeTuple _ _ = Nothing        +          makeTuple _ _ = Nothing    xPos :: Pos -> Int   xPos (Pos x _ _) = x