smarties-1.2.1: Haskell Behavior Tree Library

Copyright(c) Peter Lu 2018
LicenseGPL-3
Maintainerchippermonky@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Smarties.Nodes

Description

 
Synopsis

Documentation

control nodes

selector :: Monad m => [NodeSequenceT g p o m a] -> NodeSequenceT g p o m a Source #

weightedSelector :: (RandomGen g, Ord w, Num w, Random w, Monad m) => [(w, NodeSequenceT g p o m a)] -> NodeSequenceT g p o m a Source #

makes a weighted random selection on a list of nodes and weights this only runs the selected NodeSequence

utilitySelector :: (Ord a, NotUnit a ~ True, Monad m) => [NodeSequenceT g p o m a] -> NodeSequenceT g p o m a Source #

returns the node sequence with maximum utility N.B. that this will dry execute ALL node sequences in the input list so be mindful of performance

utilityWeightedSelector :: (RandomGen g, Random a, Num a, Ord a, NotUnit a ~ True, Monad m) => [NodeSequenceT g p o m a] -> NodeSequenceT g p o m a Source #

makes a weighted random selection on a list of nodes with weights calculated using their monadic return value N.B. that this will dry execute ALL node sequences in the input list so be mindful of performance

decorators run a nodesequence and do something with it's results

flipResult :: Monad m => NodeSequenceT g p o m a -> NodeSequenceT g p o m a Source #

decorator that flips the status (FAIL -> SUCCESS, SUCCES -> FAIL)

conditions | has given status

result :: Monad m => Status -> NodeSequenceT g p o m () Source #

condition :: Monad m => Bool -> NodeSequenceT g p o m () Source #

create a condition node, SUCCESS if true FAIL otherwise

rand Source #

Arguments

:: (RandomGen g, Monad m) 
=> Float

chance of success ∈ [0,1]

-> NodeSequenceT g p o m () 

create a node with random status based on input chance