Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data T w
- type Position = Int
- maxShipSize :: Int
- data Use
- blockBounded :: Nat w => Size w -> Position -> T w -> T w
- empty :: T w
- insertNew :: Nat w => Position -> Use -> T w -> T w
- isFree :: Nat w => T w -> Position -> Bool
- dilate :: Size w -> T w -> T w
- lookup :: Nat w => T w -> Position -> Use
- reverse :: Nat w => T w -> T w
- data Reverse w
- foldMap :: Monoid m => (Use -> m) -> T w -> m
- toList :: Nat w => T w -> [Use]
- mapToVector :: (Nat w, Storable a) => Size w -> (Use -> a) -> T w -> Vector a
- fromList :: [Use] -> T w
- fromString :: String -> T w
- propDilate :: Property
- propReverse4 :: T N4 -> Bool
- propReverse5 :: T N5 -> Bool
- propReverse6 :: T N6 -> Bool
- propReverse7 :: T N7 -> Bool
- propReverse8 :: T N8 -> Bool
- propReverse9 :: T N9 -> Bool
- propReverse10 :: T N10 -> Bool
Documentation
Efficient representation of a (Map Position Use).
We need it for description of a cut of a board with ships.
....#..... ....#..... .......... ####...... .......... ___...#...#..___ ##.#...#.. ...#...... ...#..###. ..........
Say, we are constructing the board with ships beginning from the bottom. Using information from the cut, we want to know at what positions in the upper plane are ships allowed. In the example the frontier at the cut would be
fromString "xxx3x.x1x."
The numbers 3 and 1 denotes lengths of the parts of vertical ships below the cut.
The x
's denote blocked columns,
i.e. in these columns it is not allowed to place ships
immediately above the cut.
maxShipSize :: Int Source #
blockBounded :: Nat w => Size w -> Position -> T w -> T w Source #
Inserts at positions outside of the bounds are ignored. You may overwrite Free or Blocked fields, but not Vertical ones.
insertNew :: Nat w => Position -> Use -> T w -> T w Source #
Only allowed at positions containing Free
.
fromString :: String -> T w Source #