+ hnt_str = ""
+ md = dict(arb)
+ for item in hnt:
+ number = item["number"]
+ penalty = item["penalty"]
+ turns = item["turns"]
+ question = make_c_string(md[item["question"]])
+ hint = make_c_string(md[item["hint"]])
+ hnt_str += template.format(number, penalty, turns, question, hint)
+ hnt_str = hnt_str[:-1] # trim trailing newline
+ return hnt_str
+
+
+if __name__ == "__main__":
+ with open(yaml_name, "r") as f:
+ db = yaml.load(f)
+
+ h = h_template.format(
+ get_refs(db["arbitrary_messages"]),
+ get_refs(db["locations"]),
+ get_refs(db["object_descriptions"]),
+ )
+
+ c = c_template.format(
+ h_name,
+ get_arbitrary_messages(db["arbitrary_messages"]),
+ get_class_messages(db["classes"]),
+ get_turn_thresholds(db["turn_thresholds"]),
+ get_locations(db["locations"]),
+ get_object_descriptions(db["object_descriptions"]),
+ get_obituaries(db["obituaries"]),
+ get_hints(db["hints"], db["arbitrary_messages"]),
+ len(db["classes"]),
+ len(db["obituaries"]),
+ len(db["turn_thresholds"]),
+ )