static bool adjective_debug; // put func {}'s returning a string in there static void makeGenerators(L l, final L log) { gen(l, func { "3" }); gen(l, "plus1", func { parseLong(gI())+1 }); gen(l, "delta", func { parseLong(g0())*2-parseLong(g1()) }); gen(l, "exponential", func { sqr(parseLong(g0()))/parseLong(g1()) }); // short version gen(l, "adjective magic short", func { lineAbove(findAdjectiveComment(findAdjective())) }); // long version final bool debug = adjective_debug; gen(l, "adjective magic", func { if (debug) print("last: " + last(log)); S a = findAdjective(last(log)); if (debug) print("a = " + a); if (a == null) null; int i = findAdjectiveComment(a); if (debug) print("i = " + _get(log, i)); ret _get(log, i-1); }); } static S findAdjective() { ret findAdjective(gI()); } static S findAdjective(S s) { ret findOneOfTheWords(s, "crazy", "nice"); } static int findAdjectiveComment(final S adjective) { if (adjective == null) ret -1; ret gSearch(func(S s) { matchStart("that's", s) && find3(adjective, s) }); }