Safe Haskell | None |
---|---|
Language | Haskell98 |
Basic rules building blocks. for example, you can suppress rule 1 with: do suppressRule 1
- type RuleNumber = Int
- type RuleCode = String
- data RuleEvent
- data RuleStatus
- type MetaRule = RuleInfo -> NomexNE Bool
- activateRule :: RuleNumber -> Nomex Bool
- activateRule_ :: RuleNumber -> Nomex ()
- rejectRule :: RuleNumber -> Nomex Bool
- rejectRule_ :: RuleNumber -> Nomex ()
- getRules :: NomexNE [RuleInfo]
- getActiveRules :: NomexNE [RuleInfo]
- getRule :: RuleNumber -> NomexNE (Maybe RuleInfo)
- getRulesByNumbers :: [RuleNumber] -> NomexNE [RuleInfo]
- getRuleFuncs :: NomexNE [Nomex ()]
- addRule :: RuleInfo -> Nomex Bool
- addRule_ :: RuleInfo -> Nomex ()
- addRule' :: RuleName -> Rule -> RuleCode -> String -> Nomex RuleNumber
- getFreeRuleNumber :: NomexNE RuleNumber
- suppressRule :: RuleNumber -> Nomex Bool
- suppressRule_ :: RuleNumber -> Nomex ()
- suppressAllRules :: Nomex Bool
- modifyRule :: RuleNumber -> RuleInfo -> Nomex Bool
- autoActivate :: Nomex ()
- activateOrRejectRule :: RuleInfo -> Bool -> Nomex ()
- simulate :: Nomex a -> NomexNE Bool -> NomexNE Bool
- metaruleVar :: MsgVar [(String, MetaRule)]
- createMetaruleVar :: Nomex ()
- addMetarule :: MetaRule -> String -> Nomex ()
- testWithMetaRules :: RuleInfo -> NomexNE Bool
- displayMetarules :: Nomex ()
- legal :: MetaRule
- illegal :: MetaRule
- noPlayPlayer :: PlayerNumber -> MetaRule
- immutableRule :: RuleNumber -> MetaRule
- autoDelete :: Nomex ()
- eraseAllRules :: PlayerNumber -> Nomex Bool
- getSelfRuleNumber :: NomexNE RuleNumber
- getSelfRule :: NomexNE RuleInfo
- onRuleProposed :: (RuleInfo -> Nomex ()) -> Nomex ()
- showRule :: Show a => a -> Exp Effect ()
Documentation
type RuleNumber = Int Source
data RuleStatus Source
the status of a rule.
type MetaRule = RuleInfo -> NomexNE Bool Source
A meta rule is a rule that can juge the legality of another rule.
activateRule :: RuleNumber -> Nomex Bool Source
activate a rule: change its state to Active and execute it
activateRule_ :: RuleNumber -> Nomex () Source
rejectRule :: RuleNumber -> Nomex Bool Source
reject a rule: change its state to Suppressed and suppresses all its environment (events, variables, inputs) the rule can be activated again later
rejectRule_ :: RuleNumber -> Nomex () Source
getRulesByNumbers :: [RuleNumber] -> NomexNE [RuleInfo] Source
getRuleFuncs :: NomexNE [Nomex ()] Source
addRule' :: RuleName -> Rule -> RuleCode -> String -> Nomex RuleNumber Source
add a rule to the game as described by the parameters
suppressRule :: RuleNumber -> Nomex Bool Source
suppressRule_ :: RuleNumber -> Nomex () Source
modifyRule :: RuleNumber -> RuleInfo -> Nomex Bool Source
autoActivate :: Nomex () Source
This rule will activate automatically any new rule.
activateOrRejectRule :: RuleInfo -> Bool -> Nomex () Source
activate or reject a rule
simulate :: Nomex a -> NomexNE Bool -> NomexNE Bool Source
simulate the execution of rule "sim" and then run rule "test" over the result
metaruleVar :: MsgVar [(String, MetaRule)] Source
The meta rules are stored in a list variable
createMetaruleVar :: Nomex () Source
create the meta rule variable
addMetarule :: MetaRule -> String -> Nomex () Source
add a new metarule to the list
testWithMetaRules :: RuleInfo -> NomexNE Bool Source
use the list of meta rules to juge a new rule
displayMetarules :: Nomex () Source
noPlayPlayer :: PlayerNumber -> MetaRule Source
Player p cannot propose any more rules
immutableRule :: RuleNumber -> MetaRule Source
rule number rn cannot be deleted by any incoming rule we simulate the execution of an incoming rule to make sure it doesn't delete the immutable rule
autoDelete :: Nomex () Source
a rule can autodelete itself (generaly after having performed some actions)
eraseAllRules :: PlayerNumber -> Nomex Bool Source
All rules from player p are erased:
getSelfRuleNumber :: NomexNE RuleNumber Source
allows a rule to retrieve its own number (for auto-deleting for example)
onRuleProposed :: (RuleInfo -> Nomex ()) -> Nomex () Source
sets a callback called for each rule proposed