static bool adjective_debug; // put func {}'s returning a string in there static void makeGenerators(L<Gen> l, final L<S> 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) }); }
Began life as a copy of #1003816
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003831 |
Snippet name: | Solvers for Random v7 (older version with long adjective magic) |
Eternal ID of this version: | #1003831/1 |
Text MD5: | da253b44934c56abe84bdf42e6715555 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-28 14:06:24 |
Source code size: | 1153 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 496 / 466 |
Referenced in: | -