haskellscrabble 1.1 → 1.2
raw patch · 2 files changed
+7/−2 lines, 2 filesdep +listsafePVP ok
version bump matches the API change (PVP)
Dependencies added: listsafe
API changes (from Hackage documentation)
+ Wordify.Rules.Game: getPlayer :: Game -> Int -> Maybe Player
Files
- haskellscrabble.cabal +2/−2
- src/Wordify/Rules/Game.hs +5/−0
haskellscrabble.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: haskellscrabble-version: 1.1+version: 1.2 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@@ -35,7 +35,7 @@ other-modules: Wordify.Rules.Game.Internal build-depends: base < 5, containers, array, random, mtl, transformers, QuickCheck, - parsec, unordered-containers, semigroups, errors < 2.0, safe, split, arrows+ parsec, unordered-containers, semigroups, errors < 2.0, listsafe, safe, split, arrows hs-source-dirs: src test-suite tests
src/Wordify/Rules/Game.hs view
@@ -10,6 +10,7 @@ player2, optionalPlayers, currentPlayer,+ getPlayer, playerNumber, GameStatus(InProgress, Finished), players,@@ -30,6 +31,7 @@ import Safe import Control.Monad import Control.Applicative+ import qualified Data.List.Safe as LS {- | Starts a new game. @@ -97,6 +99,9 @@ players :: Game -> [Player] players game = [player1 game, player2 game] ++ optionalsToPlayers (optionalPlayers game)++ getPlayer :: Game -> Int -> Maybe Player+ getPlayer game playerNumber = (players game) LS.!! playerNumber numberOfPlayers :: Game -> Int numberOfPlayers game = 2 + maybe 0 (\(_, maybePlayer4) -> if isJust maybePlayer4 then 2 else 1) (optionalPlayers game)