Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Mad-Libs/Aime/mad-libs.aime
Normal file
33
Task/Mad-Libs/Aime/mad-libs.aime
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
file f;
|
||||
data b;
|
||||
list l;
|
||||
record r;
|
||||
|
||||
f.stdin;
|
||||
|
||||
o_text("Enter the blank line terminated story:\n");
|
||||
|
||||
while (0 < f.b_line(b)) {
|
||||
l.append(b);
|
||||
}
|
||||
|
||||
for (, b in l) {
|
||||
integer p, q;
|
||||
text s, t;
|
||||
|
||||
while ((p = b.place('<')) ^ -1) {
|
||||
q = b.probe(p, '>');
|
||||
if (q ^ -1) {
|
||||
s = bq_string(b, p + 1, q - 1);
|
||||
b.erase(p, q);
|
||||
if (!r.key(s)) {
|
||||
o_("Replacement for `", s, "':\n");
|
||||
f.line(t);
|
||||
r.put(s, t);
|
||||
}
|
||||
b.paste(p, r[s]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l.ucall(o_, 0, "\n");
|
||||
Loading…
Add table
Add a link
Reference in a new issue