1"""
2A basic LearnSystem implementation demonstrating the capabilities of
3dynrules.
4"""
5import sys
6from dynrules import RuleSet, Rule, LearnSystem
7
8
9class Learner(LearnSystem):
10    def create_header(self):
11        return "# ----\n# HEADER\n# ----\n"
12
13    def create_footer(self):
14        return "# ----\n# FOOTER\n# ----\n"
15
16
17def create_rules():
18    ruleset = RuleSet(0, 10)
19    for i in range(20):
20        rule = Rule(i)
21        rule.weight = 1
22        rule.code = "# CODE FOR RULE %d\n" % i
23        ruleset.add(rule)
24    return ruleset
25
26
27def run():
28    ruleset = create_rules()
29    learnsystem = Learner(ruleset)
30    learnsystem.create_script("testscript.py", 10)
31
32
33if __name__ == "__main__":
34    sys.exit(run())
35