Advertisement
Coriic

Untitled

Jun 4th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. toString (Board map) =
  2. " " ++ joinListOfStrings (Prelude.map (\item -> (charToString item)) [x | x<-['A'..'S']]) ++ "\n" ++
  3. joinListOfStrings (Prelude.map (\element -> ((index element) ++ (mapToCharacter element) ++ (newLine element))) [Coordinates x y | x <- [1..19], y <- [1..19]])
  4. where
  5. mapToCharacter coordinates
  6. | (member coordinates map) = show(fromJust (Map.lookup coordinates map))
  7. | otherwise = " "
  8. newLine (Coordinates x y)
  9. | (y == 19) = "\n"
  10. | otherwise = ""
  11. index (Coordinates x y)
  12. | (y == 1 && x<10) = " " ++ show x
  13. | (y == 1 ) = show x
  14. | otherwise = ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement