Safe Haskell | None |
---|---|

Language | Haskell2010 |

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

- data Strategy a
- nullStrategy :: Strategy a -> Bool
- liftFrequency :: Frequency a -> Strategy a
- (.|) :: Strategy a -> Strategy a -> Strategy a
- reject :: Strategy a
- (.=>) :: Bool -> Strategy a -> Strategy a
- only :: (a -> Bool) -> Strategy a -> Strategy a
- bestVariant :: Strategy a -> Frequency a
- renameStrategy :: Text -> Strategy a -> Strategy a
- returN :: Text -> a -> Strategy a
- mapStrategyM :: Monad m => (a -> m (Maybe b)) -> Strategy a -> m (Strategy b)

# Documentation

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

Monad Strategy Source # | |

Functor Strategy Source # | |

Applicative Strategy Source # | |

Foldable Strategy Source # | |

Defined in Game.LambdaHack.Client.AI.Strategy fold :: 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 # elem :: Eq a => a -> Strategy a -> Bool # maximum :: Ord a => Strategy a -> a # minimum :: Ord a => Strategy a -> a # | |

Traversable Strategy Source # | |

Defined in Game.LambdaHack.Client.AI.Strategy | |

Alternative Strategy Source # | |

MonadPlus Strategy Source # | |

Show a => Show (Strategy a) Source # | |

nullStrategy :: Strategy a -> Bool Source #

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.

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.