module BishBosh.Component.PieceSquareByCoordinatesByRank(
PieceSquareByCoordinatesByRank(
),
nPiecesBounds,
gnuPlotComment,
findPieceSquareValue,
interpolatePieceSquareValues,
formatForGNUPlot,
mkPieceSquareByCoordinatesByRank
) where
import Control.Arrow((&&&), (|||))
import Data.Array.IArray((!))
import qualified BishBosh.Attribute.LogicalColour as Attribute.LogicalColour
import qualified BishBosh.Attribute.Rank as Attribute.Rank
import qualified BishBosh.Cartesian.Abscissa as Cartesian.Abscissa
import qualified BishBosh.Cartesian.Coordinates as Cartesian.Coordinates
import qualified BishBosh.Component.Piece as Component.Piece
import qualified BishBosh.Property.FixedMembership as Property.FixedMembership
import qualified BishBosh.Property.Reflectable as Property.Reflectable
import qualified BishBosh.Text.ShowList as Text.ShowList
import qualified BishBosh.Type.Count as Type.Count
import qualified Control.DeepSeq
import qualified Data.Array.IArray
import qualified Data.Foldable
import qualified Data.List
type PieceSquareValueByNPieces pieceSquareValue = Data.Array.IArray.Array Type.Count.NPieces pieceSquareValue
nPiecesBounds :: (Type.Count.NPieces, Type.Count.NPieces)
nPiecesBounds :: (NPieces, NPieces)
nPiecesBounds = (
NPieces
3 ,
NPieces -> NPieces
forall a b. (Integral a, Num b) => a -> b
fromIntegral NPieces
Attribute.LogicalColour.nDistinctLogicalColours NPieces -> NPieces -> NPieces
forall a. Num a => a -> a -> a
* NPieces
Component.Piece.nPiecesPerSide
)
type EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue = Either (
Cartesian.Coordinates.ArrayByCoordinates pieceSquareValue
) (
Cartesian.Coordinates.ArrayByCoordinates (PieceSquareValueByNPieces pieceSquareValue)
)
newtype PieceSquareByCoordinatesByRank pieceSquareValue = MkPieceSquareByCoordinatesByRank {
PieceSquareByCoordinatesByRank pieceSquareValue
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
deconstruct :: Attribute.Rank.ArrayByRank (EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
} deriving (PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool
(PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool)
-> (PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool)
-> Eq (PieceSquareByCoordinatesByRank pieceSquareValue)
forall pieceSquareValue.
Eq pieceSquareValue =>
PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool
$c/= :: forall pieceSquareValue.
Eq pieceSquareValue =>
PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool
== :: PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool
$c== :: forall pieceSquareValue.
Eq pieceSquareValue =>
PieceSquareByCoordinatesByRank pieceSquareValue
-> PieceSquareByCoordinatesByRank pieceSquareValue -> Bool
Eq, NPieces -> PieceSquareByCoordinatesByRank pieceSquareValue -> ShowS
[PieceSquareByCoordinatesByRank pieceSquareValue] -> ShowS
PieceSquareByCoordinatesByRank pieceSquareValue -> String
(NPieces
-> PieceSquareByCoordinatesByRank pieceSquareValue -> ShowS)
-> (PieceSquareByCoordinatesByRank pieceSquareValue -> String)
-> ([PieceSquareByCoordinatesByRank pieceSquareValue] -> ShowS)
-> Show (PieceSquareByCoordinatesByRank pieceSquareValue)
forall pieceSquareValue.
Show pieceSquareValue =>
NPieces -> PieceSquareByCoordinatesByRank pieceSquareValue -> ShowS
forall pieceSquareValue.
Show pieceSquareValue =>
[PieceSquareByCoordinatesByRank pieceSquareValue] -> ShowS
forall pieceSquareValue.
Show pieceSquareValue =>
PieceSquareByCoordinatesByRank pieceSquareValue -> String
forall a.
(NPieces -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PieceSquareByCoordinatesByRank pieceSquareValue] -> ShowS
$cshowList :: forall pieceSquareValue.
Show pieceSquareValue =>
[PieceSquareByCoordinatesByRank pieceSquareValue] -> ShowS
show :: PieceSquareByCoordinatesByRank pieceSquareValue -> String
$cshow :: forall pieceSquareValue.
Show pieceSquareValue =>
PieceSquareByCoordinatesByRank pieceSquareValue -> String
showsPrec :: NPieces -> PieceSquareByCoordinatesByRank pieceSquareValue -> ShowS
$cshowsPrec :: forall pieceSquareValue.
Show pieceSquareValue =>
NPieces -> PieceSquareByCoordinatesByRank pieceSquareValue -> ShowS
Show)
instance Control.DeepSeq.NFData pieceSquareValue => Control.DeepSeq.NFData (PieceSquareByCoordinatesByRank pieceSquareValue) where
rnf :: PieceSquareByCoordinatesByRank pieceSquareValue -> ()
rnf MkPieceSquareByCoordinatesByRank { deconstruct :: forall pieceSquareValue.
PieceSquareByCoordinatesByRank pieceSquareValue
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
deconstruct = ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
byRank } = ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> ()
forall a. NFData a => a -> ()
Control.DeepSeq.rnf ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
byRank
mkPieceSquareByCoordinatesByRank
:: (Attribute.Rank.Rank -> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
mkPieceSquareByCoordinatesByRank :: (Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
mkPieceSquareByCoordinatesByRank = ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
forall pieceSquareValue.
ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
MkPieceSquareByCoordinatesByRank (ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue)
-> ((Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue))
-> (Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
forall (a :: * -> * -> *) e. IArray a e => [e] -> a Rank e
Attribute.Rank.listArrayByRank ([EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue))
-> ((Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue])
-> (Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> [Rank]
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
forall a b. (a -> b) -> [a] -> [b]
`map` [Rank]
forall a. FixedMembership a => [a]
Property.FixedMembership.members)
findPieceSquareValue
:: PieceSquareByCoordinatesByRank pieceSquareValue
-> Type.Count.NPieces
-> Attribute.LogicalColour.LogicalColour
-> Attribute.Rank.Rank
-> Cartesian.Coordinates.Coordinates
-> pieceSquareValue
findPieceSquareValue :: PieceSquareByCoordinatesByRank pieceSquareValue
-> NPieces
-> LogicalColour
-> Rank
-> Coordinates
-> pieceSquareValue
findPieceSquareValue MkPieceSquareByCoordinatesByRank { deconstruct :: forall pieceSquareValue.
PieceSquareByCoordinatesByRank pieceSquareValue
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
deconstruct = ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
byRank } NPieces
nPieces LogicalColour
logicalColour Rank
rank = (
(!) (Array Coordinates pieceSquareValue
-> Coordinates -> pieceSquareValue)
-> (Array Coordinates (Array NPieces pieceSquareValue)
-> Coordinates -> pieceSquareValue)
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue
-> Coordinates
-> pieceSquareValue
forall (a :: * -> * -> *) b d c.
ArrowChoice a =>
a b d -> a c d -> a (Either b c) d
||| (
\Array Coordinates (Array NPieces pieceSquareValue)
byNPiecesByCoordinates -> (Array NPieces pieceSquareValue -> NPieces -> pieceSquareValue
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
a i e -> i -> e
! NPieces
nPieces) (Array NPieces pieceSquareValue -> pieceSquareValue)
-> (Coordinates -> Array NPieces pieceSquareValue)
-> Coordinates
-> pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Array Coordinates (Array NPieces pieceSquareValue)
byNPiecesByCoordinates Array Coordinates (Array NPieces pieceSquareValue)
-> Coordinates -> Array NPieces pieceSquareValue
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
a i e -> i -> e
!)
) (EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue
-> Coordinates -> pieceSquareValue)
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue
-> Coordinates
-> pieceSquareValue
forall a b. (a -> b) -> a -> b
$ ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
byRank ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> Rank
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
a i e -> i -> e
! Rank
rank
) (Coordinates -> pieceSquareValue)
-> (Coordinates -> Coordinates) -> Coordinates -> pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. if LogicalColour -> Bool
Attribute.LogicalColour.isBlack LogicalColour
logicalColour
then Coordinates -> Coordinates
forall a. ReflectableOnX a => a -> a
Property.Reflectable.reflectOnX
else Coordinates -> Coordinates
forall a. a -> a
id
interpolatePieceSquareValues
:: Fractional pieceSquareValue
=> pieceSquareValue
-> pieceSquareValue
-> PieceSquareValueByNPieces pieceSquareValue
interpolatePieceSquareValues :: pieceSquareValue
-> pieceSquareValue -> PieceSquareValueByNPieces pieceSquareValue
interpolatePieceSquareValues pieceSquareValue
openingGame pieceSquareValue
endGame = (NPieces, NPieces)
-> [pieceSquareValue] -> PieceSquareValueByNPieces pieceSquareValue
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
Data.Array.IArray.listArray (NPieces, NPieces)
nPiecesBounds ([pieceSquareValue] -> PieceSquareValueByNPieces pieceSquareValue)
-> ([NPieces] -> [pieceSquareValue])
-> [NPieces]
-> PieceSquareValueByNPieces pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NPieces -> pieceSquareValue) -> [NPieces] -> [pieceSquareValue]
forall a b. (a -> b) -> [a] -> [b]
map (
(pieceSquareValue -> pieceSquareValue -> pieceSquareValue)
-> (pieceSquareValue, pieceSquareValue) -> pieceSquareValue
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry pieceSquareValue -> pieceSquareValue -> pieceSquareValue
forall a. Num a => a -> a -> a
(+) ((pieceSquareValue, pieceSquareValue) -> pieceSquareValue)
-> (NPieces -> (pieceSquareValue, pieceSquareValue))
-> NPieces
-> pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (
(pieceSquareValue -> pieceSquareValue -> pieceSquareValue
forall a. Num a => a -> a -> a
* pieceSquareValue
openingGame) (pieceSquareValue -> pieceSquareValue)
-> (pieceSquareValue -> pieceSquareValue)
-> pieceSquareValue
-> (pieceSquareValue, pieceSquareValue)
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& (pieceSquareValue -> pieceSquareValue -> pieceSquareValue
forall a. Num a => a -> a -> a
* pieceSquareValue
endGame) (pieceSquareValue -> pieceSquareValue)
-> (pieceSquareValue -> pieceSquareValue)
-> pieceSquareValue
-> pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (pieceSquareValue
1 pieceSquareValue -> pieceSquareValue -> pieceSquareValue
forall a. Num a => a -> a -> a
-)
) (pieceSquareValue -> (pieceSquareValue, pieceSquareValue))
-> (NPieces -> pieceSquareValue)
-> NPieces
-> (pieceSquareValue, pieceSquareValue)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (
pieceSquareValue -> pieceSquareValue -> pieceSquareValue
forall a. Fractional a => a -> a -> a
/ NPieces -> pieceSquareValue
forall a b. (Integral a, Num b) => a -> b
fromIntegral (
(NPieces -> NPieces -> NPieces) -> (NPieces, NPieces) -> NPieces
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry NPieces -> NPieces -> NPieces
forall a. Num a => a -> a -> a
subtract (NPieces, NPieces)
nPiecesBounds
)
) (pieceSquareValue -> pieceSquareValue)
-> (NPieces -> pieceSquareValue) -> NPieces -> pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NPieces -> pieceSquareValue
forall a b. (Integral a, Num b) => a -> b
fromIntegral (NPieces -> pieceSquareValue)
-> (NPieces -> NPieces) -> NPieces -> pieceSquareValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NPieces -> NPieces -> NPieces
forall a. Num a => a -> a -> a
subtract (
(NPieces, NPieces) -> NPieces
forall a b. (a, b) -> a
fst (NPieces, NPieces)
nPiecesBounds
)
) ([NPieces] -> PieceSquareValueByNPieces pieceSquareValue)
-> [NPieces] -> PieceSquareValueByNPieces pieceSquareValue
forall a b. (a -> b) -> a -> b
$ (NPieces -> NPieces -> [NPieces])
-> (NPieces, NPieces) -> [NPieces]
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry NPieces -> NPieces -> [NPieces]
forall a. Enum a => a -> a -> [a]
enumFromTo (NPieces, NPieces)
nPiecesBounds
gnuPlotComment :: Char
= Char
'#'
formatForGNUPlot
:: (pieceSquareValue -> ShowS)
-> ShowS
-> (PieceSquareValueByNPieces pieceSquareValue -> pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
-> ShowS
formatForGNUPlot :: (pieceSquareValue -> ShowS)
-> ShowS
-> (PieceSquareValueByNPieces pieceSquareValue -> pieceSquareValue)
-> PieceSquareByCoordinatesByRank pieceSquareValue
-> ShowS
formatForGNUPlot pieceSquareValue -> ShowS
pieceSquareValueFormatter ShowS
columnDelimiter PieceSquareValueByNPieces pieceSquareValue -> pieceSquareValue
selector MkPieceSquareByCoordinatesByRank { deconstruct :: forall pieceSquareValue.
PieceSquareByCoordinatesByRank pieceSquareValue
-> ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
deconstruct = ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
byRank } = (
[ShowS] -> ShowS
showsRow (
Char -> ShowS
showChar Char
gnuPlotComment ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
'x' ShowS -> [ShowS] -> [ShowS]
forall a. a -> [a] -> [a]
: Char -> ShowS
showChar Char
'y' ShowS -> [ShowS] -> [ShowS]
forall a. a -> [a] -> [a]
: (Rank -> ShowS) -> [Rank] -> [ShowS]
forall a b. (a -> b) -> [a] -> [b]
map Rank -> ShowS
forall a. Show a => a -> ShowS
shows [Rank]
Attribute.Rank.range
) ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
) (ShowS -> ShowS)
-> ([EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ShowS)
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Coordinates, [pieceSquareValue]) -> ShowS -> ShowS)
-> ShowS -> [(Coordinates, [pieceSquareValue])] -> ShowS
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (
\(Coordinates
coordinates, [pieceSquareValue]
byRank') ShowS
showS -> let
(NPieces
x, NPieces
y) = Coordinates -> NPieces
Cartesian.Coordinates.getX (Coordinates -> NPieces)
-> (Coordinates -> NPieces) -> Coordinates -> (NPieces, NPieces)
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& Coordinates -> NPieces
Cartesian.Coordinates.getY (Coordinates -> (NPieces, NPieces))
-> Coordinates -> (NPieces, NPieces)
forall a b. (a -> b) -> a -> b
$ Coordinates
coordinates
in [ShowS] -> ShowS
showsRow (
NPieces -> ShowS
forall a. Show a => a -> ShowS
shows NPieces
x ShowS -> [ShowS] -> [ShowS]
forall a. a -> [a] -> [a]
: NPieces -> ShowS
forall a. Show a => a -> ShowS
shows NPieces
y ShowS -> [ShowS] -> [ShowS]
forall a. a -> [a] -> [a]
: (pieceSquareValue -> ShowS) -> [pieceSquareValue] -> [ShowS]
forall a b. (a -> b) -> [a] -> [b]
map pieceSquareValue -> ShowS
pieceSquareValueFormatter [pieceSquareValue]
byRank'
) ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (
if NPieces
x NPieces -> NPieces -> Bool
forall a. Eq a => a -> a -> Bool
== NPieces
Cartesian.Abscissa.xMax
then ShowS
terminateRow
else ShowS
forall a. a -> a
id
) ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
showS
) ShowS
forall a. a -> a
id ([(Coordinates, [pieceSquareValue])] -> ShowS)
-> ([EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> [(Coordinates, [pieceSquareValue])])
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Coordinates]
-> [[pieceSquareValue]] -> [(Coordinates, [pieceSquareValue])]
forall a b. [a] -> [b] -> [(a, b)]
zip (
[Coordinates]
forall a. FixedMembership a => [a]
Property.FixedMembership.members :: [Cartesian.Coordinates.Coordinates]
) ([[pieceSquareValue]] -> [(Coordinates, [pieceSquareValue])])
-> ([EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> [[pieceSquareValue]])
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> [(Coordinates, [pieceSquareValue])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[pieceSquareValue]] -> [[pieceSquareValue]]
forall a. [[a]] -> [[a]]
Data.List.transpose ([[pieceSquareValue]] -> [[pieceSquareValue]])
-> ([EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> [[pieceSquareValue]])
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> [[pieceSquareValue]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue
-> [pieceSquareValue])
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> [[pieceSquareValue]]
forall a b. (a -> b) -> [a] -> [b]
map (
Array Coordinates pieceSquareValue -> [pieceSquareValue]
forall (t :: * -> *) a. Foldable t => t a -> [a]
Data.Foldable.toList (Array Coordinates pieceSquareValue -> [pieceSquareValue])
-> (Array Coordinates (PieceSquareValueByNPieces pieceSquareValue)
-> [pieceSquareValue])
-> EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue
-> [pieceSquareValue]
forall (a :: * -> * -> *) b d c.
ArrowChoice a =>
a b d -> a c d -> a (Either b c) d
||| (PieceSquareValueByNPieces pieceSquareValue -> pieceSquareValue)
-> [PieceSquareValueByNPieces pieceSquareValue]
-> [pieceSquareValue]
forall a b. (a -> b) -> [a] -> [b]
map PieceSquareValueByNPieces pieceSquareValue -> pieceSquareValue
selector ([PieceSquareValueByNPieces pieceSquareValue]
-> [pieceSquareValue])
-> (Array Coordinates (PieceSquareValueByNPieces pieceSquareValue)
-> [PieceSquareValueByNPieces pieceSquareValue])
-> Array Coordinates (PieceSquareValueByNPieces pieceSquareValue)
-> [pieceSquareValue]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array Coordinates (PieceSquareValueByNPieces pieceSquareValue)
-> [PieceSquareValueByNPieces pieceSquareValue]
forall (t :: * -> *) a. Foldable t => t a -> [a]
Data.Foldable.toList
) ([EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ShowS)
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
-> ShowS
forall a b. (a -> b) -> a -> b
$ ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
-> [EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue]
forall (t :: * -> *) a. Foldable t => t a -> [a]
Data.Foldable.toList ArrayByRank
(EitherPieceSquareValueByNPiecesByCoordinates pieceSquareValue)
byRank where
terminateRow :: ShowS
terminateRow = Char -> ShowS
showChar Char
'\n'
showsRow :: [ShowS] -> ShowS
showsRow = ShowS -> ShowS -> ShowS -> [ShowS] -> ShowS
Text.ShowList.showsDelimitedList ShowS
columnDelimiter ShowS
forall a. a -> a
id ShowS
terminateRow