LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone



AI strategies to direct actors not controlled directly by human players. No operation in this module involves the State or Action type.



data Strategy a Source

A strategy is a choice of (non-empty) frequency tables of possible actions.


Alternative Strategy 
Monad Strategy

Strategy is a monad. TODO: Can we write this as a monad transformer?

Functor Strategy 
MonadPlus Strategy 
Applicative Strategy 
Foldable Strategy 
Traversable Strategy 
Show a => Show (Strategy a) 

liftFrequency :: Frequency a -> Strategy a Source

Strategy where only the actions from the given single frequency table can be picked.

(.|) :: Strategy a -> Strategy a -> Strategy a infixr 2 Source

Strategy with the actions from both argument strategies, with original frequencies.

reject :: Strategy a Source

Strategy with no actions at all.

(.=>) :: Bool -> Strategy a -> Strategy a infix 3 Source

Conditionally accepted strategy.

only :: (a -> Bool) -> Strategy a -> Strategy a Source

Strategy with all actions not satisfying the predicate removed. The remaining actions keep their original relative frequency values.

bestVariant :: Strategy a -> Frequency a Source

When better choices are towards the start of the list, this is the best frequency of the strategy.

renameStrategy :: Text -> Strategy a -> Strategy a Source

Overwrite the description of all frequencies within the strategy.

returN :: Text -> a -> Strategy a Source

Like return, but pick a name of the single frequency.

mapStrategyM :: Monad m => (a -> m (Maybe b)) -> Strategy a -> m (Strategy b) Source