Advertisement
Coriic

Untitled

Jun 4th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. toString (Board map) =
  2.     "  " ++ joinListOfStrings (Prelude.map charToString [x | x<-['A'..'S']]) ++ "\n" ++ joinListOfStrings (Prelude.map combine [Coordinates x y | x <- [1..19], y <- [1..19]])
  3.         where
  4.             combine s = index s ++ mapToCharacter s ++ newLine s
  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