| summaryrefslogtreecommitdiff |
path: root/tonkadur.py
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-11-01 11:36:15 +0100 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-11-01 11:36:15 +0100 |
| commit | f8140c6025bc74bac355c1b8cefd4e7fd2d75901 (patch) | |
| tree | f1593971f8d334b1e84779095e57c84ae80a20a8 /tonkadur.py | |
| parent | 08f7a91e1ba41f7be3ae8633827b46580c0aec91 (diff) | |
Adds support for option+event user inputs.
Diffstat (limited to 'tonkadur.py')
| -rw-r--r-- | tonkadur.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tonkadur.py b/tonkadur.py index e8504b8..b20b1bd 100644 --- a/tonkadur.py +++ b/tonkadur.py @@ -23,7 +23,10 @@ class Tonkadur: elif (typedef['category'] == "pointer"): return [] elif (typedef['category'] == "structure"): - return copy.deepcopy(self.types[typedef['name']]) + if (typedef['name'] == "wild dict"): + return dict() + else: + return copy.deepcopy(self.types[typedef['name']]) def __init__ (self, json_file): self.memory = dict() @@ -198,8 +201,8 @@ class Tonkadur: # print("Reading " + str(addr) + " of " + str(target)) # print("addr = " + str(addr)) target = target[addr] - # if (isinstance(target, list)): - # print("That's a list.") + # if (isinstance(target, list)): + # print("That's a list.") return target elif (computation_category == "last_choice_index"): return self.last_choice_index @@ -241,9 +244,22 @@ class Tonkadur: #print("instruction:" + str(instruction)) if (instruction_category == "add_choice"): - self.available_choices.append( - self.compute(instruction['label']) - ) + result = dict() + result["category"] = "option" + result["label"] = self.compute(instruction['label']) + self.available_choices.append(result) + self.program_counter += 1 + elif (instruction_category == "add_event_input"): + result = dict() + result["category"] = "event" + result["name"] = instruction["event"] + params = [] + + for param in instruction['parameters']: + params.append(self.compute(param)) + + result["parameters"] = params + self.available_choices.append(result) self.program_counter += 1 elif (instruction_category == "assert"): condition = self.compute(instruction['condition']) |


