// These end up inside the main class static class LEmptyBox extends LearnerImpl { static boolean debug; Learner inputLearner; char c; *(Learner *inputLearner) {} public void tryAgain() { inputLearner.tryAgain(); } public void processInOut(Object in, Object _out) { String out = (String) _out; L<S> l = toLines(out); int w = l.get(1).length(), h = l.size()-1; String input = w + "*" + h; if (debug) System.out.println("LEmptyBox: Feeding to input learner: " + in + " => " + input); inputLearner.processInOut(in, input); if (debug) System.out.println("Input learner: " + structure(inputLearner)); c = l.get(1).charAt(0); if (debug) System.out.println("LEmptyBox: c=" + c); } public Object processIn(Object in) { String input = (String) inputLearner.processIn(in); if (debug) System.out.println("LEmptyBox: in=" + in + ", input=" + input); String[] split = input.split("\\*"); int w = Integer.parseInt(split[0]), h = Integer.parseInt(split[1]); new StringBuilder buf; buf.append("\n"); buf.append(main.repeat(c, w) + "\n"); for (int y = 1; y < h-1; y++) buf.append(c + main.repeat(' ', w-2) + c + "\n"); buf.append(main.repeat(c, w) + "\n"); return buf.toString(); } public void toJava(Code code) { todo(); } }
Began life as a copy of #1000382
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
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
333 | #1000604 (pitcher) | 2015-08-18 00:07:22 | ||
332 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { // These end up inside the main class static class LEmptyBox extends LearnerImpl { static boolean debug; Learner inputLearner; char c; *(Learner *inputLearner) {} public void tryAgain() { inputLearner.tryAgain(); } public void processInOut(Object in, Object _out) { String out = (String) _out; L<S> l = toLines(out); int w = l.get(1).length(), h = l.size()-1; String input = w + "*" + h; if (debug) System.out.println("LEmptyBox: Feeding to input learner: " + in + " => " + input); inputLearner.processInOut(in, input); if (debug) System.out.println("Input learner: " + structure(inputLearner)); c = l.get(1).charAt(0); if (debug) System.out.println("LEmptyBox: c=" + c); } public Object processIn(Object in) { String input = (String) inputLearner.processIn(in); if (debug) System.out.println("LEmptyBox: in=" + in + ", input=" + input); String[] split = input.split("\\*"); int w = Integer.parseInt(split[0]), h = Integer.parseInt(split[1]); new StringBuilder buf; buf.append("\n"); buf.append(repeat(c, w) + "\n"); for (int y = 1; y < h-1; y++) buf.append(c + repeat(' ', w-2) + c + "\n"); buf.append(repeat(c, w) + "\n"); return buf.toString(); } static String repeat(char c, int n) { char[] chars = new char[n]; for (int i = 0; i < n; i++) chars[i] = c; return new String(chars); } public void toJava(Code code) { todo(); } } }} | 2015-08-18 01:46:09 | delete |