I want to add an automatic counter as an attribute in fact using clipspy it means The first fact, that you assert counts as number 1, the second as number 2 and so on. As I am beginner to Clips rules and facts coding I am not getting any idea how to add this. Thank you in advance if anyone can help me resolve this problem. Following is my code:
import clips
template_string = """
(deftemplate person
(slot name (type STRING))
(slot surname (type STRING)))
"""
Dict = {'name': 'John', 'surname': 'Doe' }
env = clips.Environment()
env.build(template_string)
template = env.find_template('person')
fact = template.assert_fact(**Dict)
assert_fact = fact
env.run()
for fact in env.facts():
print(fact)