!752 sS suckerID = "#1004698", algoID = "#1004706"; static O sucker; p { load("algoID"); showTheForm(); } svoid showTheForm { final JTextField tf = new JTextField(algoID); final JLabel score = jrightAlignedLabel(); score.setFont(typeWriterFont(35)); final JLabel len = jrightAlignedLabel(); final JLabel cs = jrightAlignedLabel(); Runnable start = r { algoID = trim(tf.getText()); save("algoID"); thread { wakeSucker(suckerID, algoID, score, len, cs); } }; onEnter(tf, start); showForm( "Algorithm/strategy to feed (ID):", tf, "What we feed:", jlabel(suckerID + " - " + getSnippetTitle(suckerID)), "Score", score, "Text Size", len, "Code Size", cs, null, jbutton("Start", start)); } static void wakeSucker(S suckerID, S algoID, JLabel scoreField, JLabel len, JLabel cs) { ping(); scoreField.setText("Calculating..."); if (sucker == null) { print("Waking..."); sucker = run(suckerID); } print("Feeding..."); S text = (S) callOpt(sucker, "getText"); S lua = loadSnippet(algoID); Sandbox s = luaSandbox(); evalLua(s, lua); LuaValue strategy = s.get("strategy"); if (!strategy.isnil()) { assertNotNull(text); LuaValue result = strategy.call(text); assertTrue(result.isstring()); lua = result.tojstring(); print("CODE:\n" + indentx(lua)); } cs.setText(n(l(lua), "Byte")); S desc = "L " + lua; O algo = makeLuaTextPredictAlgoFor(desc, sucker); O result = callOpt(sucker, "suck", desc, algo); double score = cast get(sucker, "lastScore"); scoreField.setText(formatDouble(score, 2) + " %"); len.setText(n(l(text), "Byte")); if (isTrue(result)) print("NEW BEST!!!!!"); }