Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.Map as Map
- data Coordinates = Coordinates Int Int
- instance Ord Coordinates where
- (Coordinates a b) `compare` (Coordinates c d)
- |b == d = a `compare` c
- |otherwise = b `compare` d
- data Color = W | B
- instance Show Color where
- show W = "⚇"
- show B = "⚉"
- data Board = Board (Map Coordinates Color)
- toString (Board board map)=
- where list = [Coordinates x y | x <- [1..19], y <- [1..19]]
- mapToCharacter (Coordinates coordinates) =
- |member coordinates board = lookup coordinates map
- |otherwise " "
- iterate [element] = mapToCharacter element
- iterate (listOfCoordinates:element) = (mapToCharacter element) ++ iterate(listOfCoordinates)
- iterate(list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement