LambdaHack-0.2.6.5: A roguelike game engine in early and active development

Safe HaskellNone

Game.LambdaHack.Strategy

Description

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

Synopsis

Documentation

data Strategy a Source

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

Instances

Monad Strategy

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

MonadPlus Strategy 
Show a => Show (Strategy a) 

liftFrequency :: Frequency a -> Strategy aSource

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

(.|) :: Strategy a -> Strategy a -> Strategy aSource

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

reject :: Strategy aSource

Strategy with no actions at all.

(.=>) :: Bool -> Strategy a -> Strategy aSource

Conditionally accepted strategy.

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

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

bestVariant :: Strategy a -> Frequency aSource

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

renameStrategy :: Text -> Strategy a -> Strategy aSource

Overwrite the description of all frequencies within the strategy.

returN :: Text -> a -> Strategy aSource

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