Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Enumerate all possible configurations in the Battleship game.
Synopsis
- insertShip :: Ship -> Board -> Board
- shipArea :: Ship -> Set (Int, Int)
- reduceSpace :: Ship -> Board -> Board
- shipOutline :: Ship -> Set (Int, Int)
- data Box = Box (Int, Int) (Int, Int)
- shipBounds :: Ship -> Box
- moveShip :: (Int, Int) -> Ship -> Ship
- mergeBox :: Box -> Box -> Box
- intersectBox :: Box -> Box -> Box
- boxSizes :: Box -> (Int, Int)
- emptyBoard :: (Int, Int) -> Board
- fullBoard :: (Int, Int) -> Board
- boardFromShips :: (Int, Int) -> [Ship] -> Board
- formatBoard :: Board -> String
- charmapFromShip :: Ship -> Map (Int, Int) Char
- formatShips :: (Int, Int) -> [Ship] -> String
- tryShip :: Bool -> Ship -> StateT (Set (Int, Int)) [] Ship
- tryShipsOfOneSize :: Bool -> Int -> Int -> StateT (Set (Int, Int)) [] [Ship]
- fleetFromSizes :: [ShipSize] -> Fleet
- standardFleet :: Fleet
- configurationsInFragment :: Bool -> Fleet -> Set (Int, Int) -> [[Ship]]
- configurations :: (Int, Int) -> Fleet -> [[Ship]]
- configurationsTouching :: (Int, Int) -> Fleet -> [[Ship]]
- enumerateStandard :: IO ()
- count :: (Int, Int) -> Fleet -> IO ()
- count8x8 :: IO ()
- main :: IO ()
Documentation
shipBounds :: Ship -> Box Source #
intersectBox :: Box -> Box -> Box Source #
Intersection of two boxes. If the intersection is empty, then the box will have left and right boundaries or upper and lower boundaries in swapped order.
formatBoard :: Board -> String Source #
fleetFromSizes :: [ShipSize] -> Fleet Source #
enumerateStandard :: IO () Source #