#define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC))
/* vocabulary items */
-extern long NUL;
-extern long BACK;
-extern long LOOK;
-extern long CAVE;
extern long FIND;
extern long INVENT;
extern long SAY;
-extern long ENTER;
-extern long STREAM;
-extern long DPRSSN;
-extern long ENTRNC;
extern long LOCK;
extern long THROW;
35: HUH_MAN,
}
+motions: !!omap
+- MOT_0:
+ words: !!null
+- MOT_1:
+ words: !!null
+- MOT_2:
+ words: ['road', 'hill']
+- ENTER:
+ words: ['enter']
+- MOT_4:
+ words: ['upstr']
+- MOT_5:
+ words: ['downs']
+- MOT_6:
+ words: ['fores']
+- MOT_7:
+ words: ['forwa', 'conti', 'onwar']
+- BACK:
+ words: ['back', 'retur', 'retre']
+- MOT_9:
+ words: ['valle']
+- MOT_10:
+ words: ['stair']
+- MOT_11:
+ words: ['out', 'outsi', 'exit', 'leave']
+- MOT_12:
+ words: ['build', 'house']
+- MOT_13:
+ words: ['gully']
+- STREAM:
+ words: ['strea']
+- MOT_15:
+ words: ['fork']
+- MOT_16:
+ words: ['bed']
+- MOT_17:
+ words: ['crawl']
+- MOT_18:
+ words: ['cobbl']
+- MOT_19:
+ words: ['inwar', 'insid', 'in']
+- MOT_20:
+ words: ['surfa']
+- NUL:
+ words: ['null', 'nowhe']
+- MOT_22:
+ words: ['dark']
+- MOT_23:
+ words: ['passa', 'tunne']
+- MOT_24:
+ words: ['low']
+- MOT_25:
+ words: ['canyo']
+- MOT_26:
+ words: ['awkwa']
+- MOT_27:
+ words: ['giant']
+- MOT_28:
+ words: ['view']
+- MOT_29:
+ words: ['upwar', 'up', 'u', 'above', 'ascen']
+- MOT_30:
+ words: ['d', 'downw', 'down', 'desce']
+- MOT_31:
+ words: ['pit']
+- MOT_32:
+ words: ['outdo']
+- MOT_33:
+ words: ['crack']
+- MOT_34:
+ words: ['steps']
+- MOT_35:
+ words: ['dome']
+- MOT_36:
+ words: ['left']
+- MOT_37:
+ words: ['right']
+- MOT_38:
+ words: ['hall']
+- MOT_39:
+ words: ['jump']
+- MOT_40:
+ words: ['barre']
+- MOT_41:
+ words: ['over']
+- MOT_42:
+ words: ['acros']
+- MOT_43:
+ words: ['east', 'e']
+- MOT_44:
+ words: ['west', 'w']
+- MOT_45:
+ words: ['north', 'n']
+- MOT_46:
+ words: ['south', 's']
+- MOT_47:
+ words: ['ne']
+- MOT_48:
+ words: ['se']
+- MOT_49:
+ words: ['sw']
+- MOT_50:
+ words: ['nw']
+- MOT_51:
+ words: ['debri']
+- MOT_52:
+ words: ['hole']
+- MOT_53:
+ words: ['wall']
+- MOT_54:
+ words: ['broke']
+- MOT_55:
+ words: ['y2']
+- MOT_56:
+ words: ['climb']
+- LOOK:
+ words: ['look', 'exami', 'touch', 'descr']
+- MOT_58:
+ words: ['floor']
+- MOT_59:
+ words: ['room']
+- MOT_60:
+ words: ['slit']
+- MOT_61:
+ words: ['slab', 'slabr']
+- MOT_62:
+ words: ['xyzzy']
+- DPRSSN:
+ words: ['depre']
+- ENTRNC:
+ words: ['entra']
+- MOT_65:
+ words: ['plugh']
+- MOT_66:
+ words: ['secre']
+- CAVE:
+ words: ['cave']
+- MOT_68:
+ words: !!null
+- MOT_69:
+ words: ['cross']
+- MOT_70:
+ words: ['bedqu']
+- MOT_71:
+ words: ['plove']
+- MOT_72:
+ words: ['orien']
+- MOT_73:
+ words: ['caver']
+- MOT_74:
+ words: ['shell']
+- MOT_75:
+ words: ['reser']
+- MOT_76:
+ words: ['main', 'offic']
+
hints:
- hint: &grate
name: CAVE
long LNLENG, LNPOSN;
char rawbuf[LINESIZE], INLINE[LINESIZE + 1];
-long NUL;
-long BACK;
-long LOOK;
-long CAVE;
long FIND;
long INVENT;
long SAY;
-long ENTER;
-long STREAM;
-long DPRSSN;
-long ENTRNC;
long LOCK;
long THROW;
/* Define some handy mnemonics. */
- /* These are motion-verb numbers. */
- BACK = VOCWRD(WORD_BACK, 0);
- CAVE = VOCWRD(WORD_CAVE, 0);
- DPRSSN = VOCWRD(WORD_DPRSSN, 0);
- ENTER = VOCWRD(WORD_ENTER, 0);
- ENTRNC = VOCWRD(WORD_ENTRNC, 0);
- LOOK = VOCWRD(WORD_LOOK, 0);
- NUL = VOCWRD(WORD_NUL, 0);
- STREAM = VOCWRD(WORD_STREAM, 0);
-
- /* And some action verbs. */
+ /* Some action verbs. */
FIND = VOCWRD(WORD_FIND, 2);
INVENT = VOCWRD(WORD_INVENT, 2);
LOCK = VOCWRD(WORD_LOCK, 2);
long LNLENG, LNPOSN;
char rawbuf[LINESIZE], INLINE[LINESIZE + 1];
-long NUL;
-long BACK;
-long LOOK;
-long CAVE;
long FIND;
long INVENT;
long SAY;
-long ENTER;
-long STREAM;
-long DPRSSN;
-long ENTRNC;
long LOCK;
long THROW;
}} hint_t;
typedef struct {{
- const char* word;
- const int type;
- const int value;
-}} vocabulary_t;
+ const char** words;
+}} motion_t;
extern const location_t locations[];
extern const object_t objects[];
extern const obituary_t obituaries[];
extern const hint_t hints[];
extern long conditions[];
-extern const vocabulary_t vocabulary[];
extern const long actspk[];
+extern const motion_t motions[];
#define NLOCATIONS {}
#define NOBJECTS {}
#define NDEATHS {}
#define NTHRESHOLDS {}
#define NVERBS {}
-#define NVOCAB {}
#define NTRAVEL {}
enum arbitrary_messages_refs {{
{}
}};
+enum motion_refs {{
+{}
+}};
+
/* State definitions */
{}
{}
}};
-const vocabulary_t vocabulary[] = {{
+const long actspk[] = {{
+ NO_MESSAGE,
{}
}};
-const long actspk[] = {{
- NO_MESSAGE,
+const motion_t motions[] = {{
{}
}};
sys.stderr.write("%s is not a known word classifier\n" % attrs["type"])
sys.exit(1)
-def get_vocabulary(vocabulary):
- template = """ {{
- .word = {},
- .type = {},
- .value = {},
- }},
-"""
- voc_str = ""
- for vocab in vocabulary:
- word = make_c_string(vocab["word"])
- type_code = recompose(vocab["type"], vocab["value"])
- value = vocab["value"]
- voc_str += template.format(word, type_code, value)
- voc_str = voc_str[:-1] # trim trailing newline
- return voc_str
-
def get_actspk(actspk):
res = ""
for (i, word) in actspk.items():
#print(tuple(tt))
return (ltravel, lkeys)
+def get_motions(motions):
+ template = """ {{
+ .words = {},
+ }},
+"""
+ mot_str = ""
+ for motion in motions:
+ contents = motion[1]
+ if contents["words"] == None:
+ mot_str += template.format("NULL")
+ continue
+ c_words = [make_c_string(s) for s in contents["words"]]
+ words_str = "(const char* []) {" + ", ".join(c_words) + "}"
+ mot_str += template.format(words_str)
+ return mot_str
+
if __name__ == "__main__":
with open(yaml_name, "r") as f:
db = yaml.load(f)
get_obituaries(db["obituaries"]),
get_hints(db["hints"], db["arbitrary_messages"]),
get_condbits(db["locations"]),
- get_vocabulary(db["vocabulary"]),
get_actspk(db["actspk"]),
+ get_motions(db["motions"]),
)
h = h_template.format(
len(db["obituaries"]),
len(db["turn_thresholds"]),
len(db["actspk"]),
- len(db["vocabulary"]),
len(travel),
get_refs(db["arbitrary_messages"]),
get_refs(db["locations"]),
get_refs(db["objects"]),
+ get_refs(db["motions"]),
statedefines,
)