| Safe Haskell | Safe |
|---|---|
| Language | Haskell98 |
Game.Mastermind
- data Eval = Eval Int Int
- evaluate :: Ord a => [a] -> [a] -> Eval
- histogram :: Ord a => [a] -> Map a Int
- selectFromHistogram :: Ord a => Map a Int -> [(a, Map a Int)]
- remainingSimple :: Ord a => Set a -> [a] -> Int -> [[Set a]]
- possibleRightPlaces :: Int -> Int -> [[Bool]]
- remaining :: (C set, Ord a) => Set a -> [a] -> Eval -> set a
- partitionSizes :: Ord a => Set a -> [a] -> [(Eval, Integer)]
- possibleEvaluations :: Int -> [Eval]
- interaction :: (T Char -> StateT state Maybe [Char]) -> state -> Set Char -> Int -> IO ()
- mainSimple :: Set Char -> Int -> IO ()
- randomSelect :: (RandomGen g, Monad m) => [a] -> StateT g m a
- minimax :: Ord b => [(a, [b])] -> a
- randomizedAttempt :: (C set, RandomGen g, Ord a) => Int -> Set a -> set a -> StateT g Maybe [a]
- mixedRandomizedAttempt :: (C set, RandomGen g, Ord a) => Int -> Set a -> set a -> StateT g Maybe [a]
- mainRandom :: Set Char -> Int -> IO ()
- main :: IO ()
Documentation
remainingSimple :: Ord a => Set a -> [a] -> Int -> [[Set a]] Source #
A variant of the game: It is only possible to specify number of symbols at right places.
The results of remaining and remainingSimple cannot be compared.
remaining :: (C set, Ord a) => Set a -> [a] -> Eval -> set a Source #
Given a code and an according evaluation, compute the set of possible codes.
The Game.Mastermind game consists of collecting pairs of codes and their evaluations. The searched code is in the intersection of all corresponding code sets.
possibleEvaluations :: Int -> [Eval] Source #
randomizedAttempt :: (C set, RandomGen g, Ord a) => Int -> Set a -> set a -> StateT g Maybe [a] Source #