Nomyx-Language-0.6.1: Language to express rules for Nomic

Safe HaskellNone

Language.Nomyx.Rules

Description

Basic rules building blocks. for example, you can suppress rule 1 with: do suppressRule 1

Synopsis

Documentation

data RuleStatus Source

the status of a rule.

Constructors

Active 
Pending 
Reject 

type MetaRule = RuleInfo -> NomexNE BoolSource

A meta rule is a rule that can juge the legality of another rule.

activateRule :: RuleNumber -> Nomex BoolSource

activate a rule: change its state to Active and execute it

rejectRule :: RuleNumber -> Nomex BoolSource

reject a rule: change its state to Suppressed and suppresses all its environment (events, variables, inputs) the rule can be activated again later

addRule :: RuleInfo -> Nomex BoolSource

add a rule to the game, it will have to be activated

autoActivate :: Nomex ()Source

This rule will activate automatically any new rule.

activateOrReject :: RuleInfo -> Bool -> Nomex ()Source

activate or reject a rule

simulate :: Nomex a -> NomexNE Bool -> NomexNE BoolSource

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 BoolSource

use the list of meta rules to juge a new rule

legal :: MetaRuleSource

A rule will be always legal

illegal :: MetaRuleSource

A rule will be always illegal

noPlayPlayer :: PlayerNumber -> MetaRuleSource

Player p cannot propose any more rules

immutableRule :: RuleNumber -> MetaRuleSource

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 BoolSource

All rules from player p are erased:

getSelfRuleNumber :: NomexNE RuleNumberSource

allows a rule to retrieve its own number (for auto-deleting for example)

showRule :: Show a => a -> Exp Effect ()Source