abstract sclass DynPhilosophyBotTextArea extends DynTextArea { S output, logicRules, factsOut; int nFacts; bool enabled = true; transient PhilosophyBot1 bot; transient ReliableSingleThread rstRunProgram = dm_rst(this, r runProgram); transient JLabel lblStatus; transient ReliableSingleThread rstLogicRules = dm_rst(this, r showLogicRules); transient ReliableSingleThread rstFactsOut = dm_rst(this, r showFactsDeduced); visual jvsplit( jCenteredSection("Program", super), centerAndSouth( jhsplit( jCenteredSection("Output", dm_textArea_scrollDown_readOnly output()), jCenteredLiveValueSection(dm_calculatedLiveValue(S, () -> "Facts deduced (" + nFacts + ")"), dm_textArea_scrollDown_readOnly factsOut()) ), withLeftAndRightMargin(centerAndEastWithMargin( dm_checkBox enabled(), lblStatus = jRightAlignedLabel())))); start { grabInterval = 1.0; dm_watchFieldAndNow text(rstRunProgram); } void runProgram { temp tempMiniLoadingAnim(); time { setField(output := hijackPrint(r { pcall { bot = new PhilosophyBot1(text); bot.printFactsAfterThinking = false; bot.onLogicRuleAdded.add(rule -> rstLogicRules.run()); bot.onFactAdded.add(f -> rstFactsOut.run()); bot.standardImports(); philosophyBot1_addEnableableExtension(bot, "autoJava", _bot -> philosophyBot_autoJava(_bot)); bot.run(); bot.checkExpectations(); } })); } main setText(lblStatus, lastTiming_formatted()); } void showLogicRules { setField(logicRules := joinWithEmptyLines(allToString(cloneList(bot.logicRules)))); } void showFactsDeduced { Cl facts = bot.factsDeduced(); setField(nFacts := l(facts)); setField(factsOut := lines(facts)); } }