haskellscrabble 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+9/−6 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Wordify.Rules.Board.Internal: instance Show Board
+ Wordify.Rules.Board: instance Show Board
Files
- haskellscrabble.cabal +1/−1
- src/Wordify/Rules/Board.hs +7/−4
- src/Wordify/Rules/Board/Internal.hs +1/−1
haskellscrabble.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: haskellscrabble-version: 0.1.0.1+version: 0.1.0.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
src/Wordify/Rules/Board.hs view
@@ -13,6 +13,9 @@ import Data.List.Split import Data.List + instance Show Board where+ show = prettyPrint+ {- | Returns all the squares on the board, ordered by column then row. -}@@ -62,17 +65,17 @@ prettyPrint :: Board -> String prettyPrint board = rowsWithLabels ++ columnLabelSeparator ++ columnLabels where- rows = transpose $ chunksOf 15 $ map (squareToString . snd) $ allSquares board- rowsWithLabels = concatMap (\(rowNo, row) -> (rowStr rowNo) ++ concat row ++ "\n") $ Prelude.zip [1 .. ] rows+ rows = transpose . chunksOf 15 . map (squareToString . snd) . allSquares+ rowsWithLabels = concatMap (\(rowNo, row) -> (rowStr rowNo) ++ concat row ++ "\n") . Prelude.zip [1 .. ] $ (rows board) rowStr :: Int -> String rowStr number = if number < 10 then ((show number) ++ " | ") else (show number) ++ "| " columnLabelSeparator = " " ++ (Prelude.take (15 * 5) $ repeat '-') ++ "\n"- columnLabels = " " ++ (concat $ Prelude.take (15 *2) $ intersperse " " $ map ( : []) ['A' .. ])+ columnLabels = " " ++ (concat $ Prelude.take (15 * 2) . intersperse " " . map ( : []) $ ['A' .. ]) squareToString square = case (tileIfOccupied square) of- Just sq -> maybe " [_] " (\lt -> " [" ++ lt : "] ") $ tileLetter sq+ Just sq -> maybe " |_| " (\lt -> " |" ++ lt : "| ") $ tileLetter sq Nothing -> case square of (Normal _) -> " N "
src/Wordify/Rules/Board/Internal.hs view
@@ -4,4 +4,4 @@ import Wordify.Rules.Square import qualified Data.Map as Map - data Board = Board (Map.Map Pos Square) deriving (Show, Eq)+ data Board = Board (Map.Map Pos Square) deriving (Eq)