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

Safe HaskellNone
LanguageHaskell98

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 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

rejectRule :: RuleNumber -> Nomex Bool Source

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

addRule :: RuleInfo -> Nomex Bool Source

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

addRule' :: RuleName -> Rule -> RuleCode -> String -> Nomex RuleNumber Source

add a rule to the game as described by the parameters

proposeRule :: RuleInfo -> Nomex Bool Source

propose a rule that will need to be voted on.

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

legal :: MetaRule Source

A rule will be always legal

illegal :: MetaRule Source

A rule will be always illegal

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

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