>>> import json
>>> import zen
>>> z = zen.ZenEngine()
>>> jdm = open("/tmp/decision.json").read()
>>> jdm_dict = json.loads(jdm)
>>> decision = z.create_decision(jdm_dict)
>>> context = """
... {
... "event": {
... "event_type": "KillEvent",
... "source": 123
... },
... "account": {
... "battle_player_id": 123
... }
... }
... """
>>> result = decision.evaluate(context)
>>> result
{'performance': '2.8ms', 'result': {'account': {'battle_player_id': 123}, 'event': {'event_type': 'KillEvent', 'source': 123}, 'quest_complete': True}}
zen/bindings/python/zen.pyi
Line 17 in 61465bd
ZenEngine.create_decision()happily takes a dict: