Libraryless. Click here for Pure Java version (2245L/15K/49K).
!759 static new L<S> turingTests; p { load("turingTests"); } synchronized answer { if "turing score" ret getTuringScore(); if "turing tests" ret structure(turingTests); if "tests running" ret structure(testsRunning); // TODO: solve the sync problem try answer manageSnippetList(s, "turing test", "turingTests"); if "run turing test *" { S id = m.fsi(0); if (!turingTests.contains(id)) ret "Not a turing test: " + id; runTestAsync(id); S url = mainURL() + "1002408?id=" + parseSnippetID(id); ret "Test " + shortSnippetLink(id) + " running. Check result here: " + url; } } static S html(S subUri, Map<S, S> params) { L<S> keepFields = litlist(); S protocolID = params.get("id"); S html = htag("p", "Eleutheria's current Turing score: " + htag("b", getTuringScore())); html += htag("p", "Tests running: " + structure(testsRunning)); if (isSnippetID(protocolID)) { S protocol = loadTextFile(getProgramFile(protocolID, "protocol-" + urlencode(getTuringScore_eleuURL))); html += tag("h3", "Protocol of " + quote(getSnippetTitle(protocolID)) + " (" + formatSnippetID(protocolID) + ")") + sourceCodeToHTML(protocol); } html += tag("h3", "Tests"); html += "<ul>"; for (S id : turingTests) html += tag("li", tag("a", formatSnippetID(id) + " - " + getSnippetTitle(id), "href", selfLink(params, keepFields, "id", "" + parseSnippetID(id))) + " " + tag("a", "[source]", "href", "http://tinybrain.de/" + parseSnippetID(id))); html += "</ul>"; ret html; } static S snippetLink(S id) { ret tag("a", formatSnippetID(id) + " - " + getSnippetTitle(id), "href", "http://tinybrain.de/" + parseSnippetID(id)); } static S getTuringScore_eleuURL = "http://bots.tinybrain.de/1002076/raw"; static S getTuringScore() { long s = 0, n = 0; int tests = 0; for (S testID : turingTests) pcall { PersistentMap<S, O> scores = new PersistentMap(testID, "turing-scores.map"); O score = scores.get(getTuringScore_eleuURL); if (score == null) continue; s += (long) get(score, "score"); n += (long) get(score, "n"); ++tests; } S result = s + " of " + n + " points (" + n(tests, "test"); int notRun = l(turingTests)-tests; if (notRun > 0) result += ", " + notRun + " not run yet"; ret result + ")"; } static L<S> testsRunning = synchroList(); static void runTestAsync(final S testID) { Runnable code = runnable { testsRunning.add(testID); try { Class test = main.hotwire(testID); setOpt(test, "mainBot", getMainBot()); // let test know that we are in Eleu process (allows for faster testing) callMain(test); } finally { testsRunning.remove(testID); } }; O processManager = getBot("#1002558"); if (processManager == null) new Thread(code).start(); else call(processManager, "start", "Turing Test " + testID, code); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nysugtttblhj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment