module Combinatorics.Battleship where

import Data.Map (Map, )
import Data.Set (Set, )


type ShipSize = Int
type NumberOfShips = Int
type Fleet = Map ShipSize NumberOfShips


data Orientation = Horizontal | Vertical
   deriving (Int -> Orientation -> ShowS
[Orientation] -> ShowS
Orientation -> String
(Int -> Orientation -> ShowS)
-> (Orientation -> String)
-> ([Orientation] -> ShowS)
-> Show Orientation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Orientation] -> ShowS
$cshowList :: [Orientation] -> ShowS
show :: Orientation -> String
$cshow :: Orientation -> String
showsPrec :: Int -> Orientation -> ShowS
$cshowsPrec :: Int -> Orientation -> ShowS
Show, Orientation -> Orientation -> Bool
(Orientation -> Orientation -> Bool)
-> (Orientation -> Orientation -> Bool) -> Eq Orientation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Orientation -> Orientation -> Bool
$c/= :: Orientation -> Orientation -> Bool
== :: Orientation -> Orientation -> Bool
$c== :: Orientation -> Orientation -> Bool
Eq, Eq Orientation
Eq Orientation
-> (Orientation -> Orientation -> Ordering)
-> (Orientation -> Orientation -> Bool)
-> (Orientation -> Orientation -> Bool)
-> (Orientation -> Orientation -> Bool)
-> (Orientation -> Orientation -> Bool)
-> (Orientation -> Orientation -> Orientation)
-> (Orientation -> Orientation -> Orientation)
-> Ord Orientation
Orientation -> Orientation -> Bool
Orientation -> Orientation -> Ordering
Orientation -> Orientation -> Orientation
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Orientation -> Orientation -> Orientation
$cmin :: Orientation -> Orientation -> Orientation
max :: Orientation -> Orientation -> Orientation
$cmax :: Orientation -> Orientation -> Orientation
>= :: Orientation -> Orientation -> Bool
$c>= :: Orientation -> Orientation -> Bool
> :: Orientation -> Orientation -> Bool
$c> :: Orientation -> Orientation -> Bool
<= :: Orientation -> Orientation -> Bool
$c<= :: Orientation -> Orientation -> Bool
< :: Orientation -> Orientation -> Bool
$c< :: Orientation -> Orientation -> Bool
compare :: Orientation -> Orientation -> Ordering
$ccompare :: Orientation -> Orientation -> Ordering
$cp1Ord :: Eq Orientation
Ord)

data Ship = Ship ShipSize Orientation (Int, Int)
   deriving (Int -> Ship -> ShowS
[Ship] -> ShowS
Ship -> String
(Int -> Ship -> ShowS)
-> (Ship -> String) -> ([Ship] -> ShowS) -> Show Ship
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ship] -> ShowS
$cshowList :: [Ship] -> ShowS
show :: Ship -> String
$cshow :: Ship -> String
showsPrec :: Int -> Ship -> ShowS
$cshowsPrec :: Int -> Ship -> ShowS
Show, Ship -> Ship -> Bool
(Ship -> Ship -> Bool) -> (Ship -> Ship -> Bool) -> Eq Ship
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ship -> Ship -> Bool
$c/= :: Ship -> Ship -> Bool
== :: Ship -> Ship -> Bool
$c== :: Ship -> Ship -> Bool
Eq, Eq Ship
Eq Ship
-> (Ship -> Ship -> Ordering)
-> (Ship -> Ship -> Bool)
-> (Ship -> Ship -> Bool)
-> (Ship -> Ship -> Bool)
-> (Ship -> Ship -> Bool)
-> (Ship -> Ship -> Ship)
-> (Ship -> Ship -> Ship)
-> Ord Ship
Ship -> Ship -> Bool
Ship -> Ship -> Ordering
Ship -> Ship -> Ship
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Ship -> Ship -> Ship
$cmin :: Ship -> Ship -> Ship
max :: Ship -> Ship -> Ship
$cmax :: Ship -> Ship -> Ship
>= :: Ship -> Ship -> Bool
$c>= :: Ship -> Ship -> Bool
> :: Ship -> Ship -> Bool
$c> :: Ship -> Ship -> Bool
<= :: Ship -> Ship -> Bool
$c<= :: Ship -> Ship -> Bool
< :: Ship -> Ship -> Bool
$c< :: Ship -> Ship -> Bool
compare :: Ship -> Ship -> Ordering
$ccompare :: Ship -> Ship -> Ordering
$cp1Ord :: Eq Ship
Ord)

data Board = Board (Int, Int) (Set (Int, Int))