static class LCombineTwoFunctions extends LearnerImpl {
static boolean debug;
Function f, g;
public void processInOut(Object in, Object out) {
if (f != null) return;
List<Function> functions = allFunctions();
// simple version without really checking multiple candidates
for (Function f : functions) {
Object o = tryProcess(f, in);
if (o != null) {
if (debug)
debug("in=" + structure(in) + ", f=" + structure(f) + ", o=" + structure(o));
for (Function g : functions) {
Object x = tryProcess(g, o);
if (out.equals(x)) {
if (debug)
debug("bingo! " + structure(g));
this.f = f;
this.g = g;
return;
}
}
}
}
}
public Object processIn(Object in) {
return g.process(f.process(in));
}
static Object tryProcess(Function f, Object in) {
try {
return f.process(in);
} catch (Throwable e) {
return null;
}
}
}Began life as a copy of #1000470
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1000500 |
| Snippet name: | LCombineTwoFunctions (learner) |
| Eternal ID of this version: | #1000500/1 |
| Text MD5: | 3ac2d234ac18179bd14e8c0613853b6d |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-08-09 18:21:14 |
| Source code size: | 1056 bytes / 40 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 912 / 1620 |
| Referenced in: | #722 - IOIOI Processor (v15) #738 - IOIOI Solver (v16, most recent one) #1000506 - LCombineTwoFunctions2 (learner) #3000382 - Answer for ferdie (>> t = 1, f = 0) |