Flipping bits game: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: Specified imports, applied hlint, hindent)
m (→‎{{header|Haskell}}: (Slightly reordered imports, for legibility))
Line 1,264: Line 1,264:
=={{header|Haskell}}==
=={{header|Haskell}}==
Maximum game size is 9x9 because the array indices are the characters 1 until 9.
Maximum game size is 9x9 because the array indices are the characters 1 until 9.
<lang Haskell>import Data.Array (Array, (!), (//), array, bounds)
<lang Haskell>import Data.List (intersperse)


import Data.List (intersperse)
import System.Random (randomRIO)


import Control.Monad (zipWithM_, replicateM, foldM, when)
import Data.Array (Array, (!), (//), array, bounds)


import Control.Monad (zipWithM_, replicateM, foldM, when)
import System.Random (randomRIO)


type Board = Array (Char, Char) Int
type Board = Array (Char, Char) Int
Line 1,284: Line 1,284:


numCols t =
numCols t =
let ((_, a), (_, b)9) = bounds t
let ((_, a), (_, b)) = bounds t
in [a .. b]
in [a .. b]