LambdaHack-0.9.4.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Game.LambdaHack.Client.AI.Strategy

Description

AI strategies to direct actors not controlled directly by human players. No operation in this module involves the State type or any of our client/server monads types.

Synopsis

# Documentation

data Strategy a Source #

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

Currently, the way we use it, the list could have at most one element (we filter out void frequencies early and only ever access the first). except for the argument of mapStrategyM, which may even be process to the end of the list, if no earlier strategies can be transformed into non-null ones.

Instances
 Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methods(>>=) :: Strategy a -> (a -> Strategy b) -> Strategy b #(>>) :: Strategy a -> Strategy b -> Strategy b #return :: a -> Strategy a #fail :: String -> Strategy a # Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methodsfmap :: (a -> b) -> Strategy a -> Strategy b #(<\$) :: a -> Strategy b -> Strategy a # Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methodspure :: a -> Strategy a #(<*>) :: Strategy (a -> b) -> Strategy a -> Strategy b #liftA2 :: (a -> b -> c) -> Strategy a -> Strategy b -> Strategy c #(*>) :: Strategy a -> Strategy b -> Strategy b #(<*) :: Strategy a -> Strategy b -> Strategy a # Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methodsfold :: Monoid m => Strategy m -> m #foldMap :: Monoid m => (a -> m) -> Strategy a -> m #foldr :: (a -> b -> b) -> b -> Strategy a -> b #foldr' :: (a -> b -> b) -> b -> Strategy a -> b #foldl :: (b -> a -> b) -> b -> Strategy a -> b #foldl' :: (b -> a -> b) -> b -> Strategy a -> b #foldr1 :: (a -> a -> a) -> Strategy a -> a #foldl1 :: (a -> a -> a) -> Strategy a -> a #toList :: Strategy a -> [a] #null :: Strategy a -> Bool #length :: Strategy a -> Int #elem :: Eq a => a -> Strategy a -> Bool #maximum :: Ord a => Strategy a -> a #minimum :: Ord a => Strategy a -> a #sum :: Num a => Strategy a -> a #product :: Num a => Strategy a -> a # Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methodstraverse :: Applicative f => (a -> f b) -> Strategy a -> f (Strategy b) #sequenceA :: Applicative f => Strategy (f a) -> f (Strategy a) #mapM :: Monad m => (a -> m b) -> Strategy a -> m (Strategy b) #sequence :: Monad m => Strategy (m a) -> m (Strategy a) # Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methods(<|>) :: Strategy a -> Strategy a -> Strategy a #some :: Strategy a -> Strategy [a] #many :: Strategy a -> Strategy [a] # Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy Methodsmplus :: Strategy a -> Strategy a -> Strategy a # Show a => Show (Strategy a) Source # Instance detailsDefined in Game.LambdaHack.Client.AI.Strategy MethodsshowsPrec :: Int -> Strategy a -> ShowS #show :: Strategy a -> String #showList :: [Strategy a] -> ShowS #

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.

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.

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

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 #