-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (44 loc) · 1.75 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from estm_model_checker.estm_rule_parser import ESTMRuleParser
from estm_model_checker.model_checker import models_for_map, format_models
from map_generator.map_generator import maps_from_models,maps_to_worlds
def print_map(m):
out = list()
for elm in m:
contents = [tuple(x)[0] for x in elm]
out.append("".join(contents))
print('\n'.join(out))
def main():
img = [
'🌳🌳🌳🌳🌳🌳🌳🌳🌳🌳',
'🌳🌳🌳🌳🌳🌳🌳🌳🌳🌳',
'🌳🌳🌳🌳🌳🌳🌳🌳🌳🌳',
'🌳🌳🌳🌳🌳🌳🌳🌳🌳🌳',
'🌳🌳🌳🌳🌳🐚🌳🌳🐚🌴',
'🌳🌳🌳🌳🌴🌊🌴🌴🌊🌊',
'🌳🌳🌳🌴🌊🌊🌊🌊🌊🌊',
'🌳🌳🌴🌊🌊🌊🌊🌊🌊🌊',
'🌳🌴🌊🌊🌊🌊🌊🌊🌊🌊',
'🐚🌊🌊🌊🌊🌊🌊🌊🌊🌊'
]
rule_parser = ESTMRuleParser(img)
rules,_,literals = rule_parser.calc_rules()
map_size = (5,5)
model_ruleset,models,indexed_literals = models_for_map(map_size=map_size, literals=literals, rule_dict=rules)
print('*** MODEL RULESET ***')
print(model_ruleset)
model_list = list(models)
print('*** MODELS ***')
print(model_list)
print('*** MODELS FOR RULESET ***')
m, sorted_keys = format_models(indexed_literals=indexed_literals, models=model_list)
print(",".join(sorted_keys))
for mod in m:
print(mod)
maps_dicts = maps_from_models(model_list=model_list)
worlds = maps_to_worlds(maps_dicts, map_size)
print('*** GENERATED MAPS ***')
for w in worlds:
print_map(w)
print()
if __name__ == "__main__":
main()